location of 10 highest values

18 vues (au cours des 30 derniers jours)
Mate 2u
Mate 2u le 25 Juil 2012
Hi all, I have a 1x34 matrix. I want to find the location of the 10 largest values. So the output should be 1x10 and have values like 2,3,6 etc......
Thank you.

Réponse acceptée

Walter Roberson
Walter Roberson le 25 Juil 2012
[bigvalues, bigidx] = sort(YourMatrix, 'descend');
bigidx(1:10)
However, this is not suitable if your values might not be unique. Also, if your values might include NaN then you need to decide whether for your purpose NaN are high or not.

Plus de réponses (1)

the cyclist
the cyclist le 25 Juil 2012
Use the sort() command.

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by