location of 10 highest values

11 ビュー (過去 30 日間)
Mate 2u
Mate 2u 2012 年 7 月 25 日
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 Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by