10 Largest numbers in a matrix

3 visualizaciones (últimos 30 días)
Md
Md el 4 de Mzo. de 2015
Respondida: per isakson el 4 de Mzo. de 2015
how to find 10 biggest numbers from a Matrix, also how to find the indexes of those 10 biggest numbers in the matrix. Thanks.
  1 comentario
Daniel
Daniel el 4 de Mzo. de 2015
Are you asking for a specific command, or how to go about creating a program that will get you that result from a series of calculations replicating what you yourself would do "by inspection"?
It should be straightforward how to do the latter. I don't think I can help with the former.

Iniciar sesión para comentar.

Respuestas (1)

per isakson
per isakson el 4 de Mzo. de 2015
The largest value of magic(7) is 49
M = magic(7);
[ val, ix ] = sort(M(:),'descend');
[rr,cc] = ind2sub( [7,7],ix(1:10) );
>> [rr(1),cc(1)]
ans =
7 4
>> M(rr(1),cc(1))
ans =
49
>> M(rr(10),cc(10))
ans =
40
is one way to find the 10 largest values

Categorías

Más información sobre Mathematics 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