finding the 10 lowest values
Afficher commentaires plus anciens
I have a matrix with a lot of data, and i want to find the 10 lowest values of a specific collum.
Does anybody know how to do that?
i was thinking about using the function min() but it does not allow me to select a specific collum, or finding more than the one value which is the lowest.
Réponse acceptée
Plus de réponses (2)
the cyclist
le 13 Oct 2011
First 10 values of "sorted_x" is what you want.
A = rand(100,10);
columnToSort = 7;
[sorted_x, index] = sort(A(:,columnToSort),'ascend');
Marc
le 23 Fév 2017
0 votes
But if I want the indexes of these 10 values? Should I sort to find the values and then "find" these values in the matrix?
Is there a more elegant way?
1 commentaire
Adam
le 23 Fév 2017
the cyclist gave an answer that also returns indices. You can just feed these directly into your array.
Catégories
En savoir plus sur Shifting and Sorting Matrices 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!