location of 10 highest values

16 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2012-7-25
[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.

更多回答(1 个)

the cyclist
the cyclist 2012-7-25
Use the sort() command.

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by