location of 10 highest values

Asked by Mate 2u on 25 Jul 2012
Latest activity Answered by Walter Roberson on 25 Jul 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.

0 Comments

Mate 2u

Products

No products are associated with this question.

2 Answers

Answer by Walter Roberson on 25 Jul 2012
Accepted answer
[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.

0 Comments

Walter Roberson
Answer by the cyclist on 25 Jul 2012

Use the sort() command.

0 Comments

the cyclist

Contact us