Finding Minimum Distance Between Points to Find Indexed Variable
Afficher commentaires plus anciens
Hi All,
Two matrices, one here with size 1251x3:
dtamatrix = [xFe54t(:),Fo(:),DeltaFe56(:)];
And another one here, with size 4x1:
Felimitmatrix = [Foyqlimit(:)]
First, I want to find which values of Fo each of my Foyqlimit values are closest to, generating four values of Fo. Then, I want my code to read the specific xFe54t values that correspond with these four values of Fo, generating a 4x1 column vector of xFe54t values.
Can anyone provide any insight as to how to do this?
Thanks,
Joanthan
2 commentaires
darova
le 12 Mar 2020
Too much explanations. Couldn't handle them
Can you make a simple drawing or something?
Jonathan Pinko
le 13 Mar 2020
Réponse acceptée
Plus de réponses (1)
darova
le 13 Mar 2020
Use pdist2 to find closest points
D = pdist2(Fo(:),Foyqlimit(:)); % every combination (Matrix 1251x4)
[~,ix] = min(D); % closest indices
xFe54t(ix) % values you want
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!