location of 10 highest values

조회 수: 17 (최근 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 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