location of 10 highest values

17 visualizaciones (últimos 30 días)
Mate 2u
Mate 2u el 25 de Jul. de 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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Jul. de 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.

Más respuestas (1)

the cyclist
the cyclist el 25 de Jul. de 2012
Use the sort() command.

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by