필터 지우기
필터 지우기

10 Largest numbers in a matrix

조회 수: 4 (최근 30일)
Md
Md 2015년 3월 4일
답변: per isakson 2015년 3월 4일
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
Daniel
Daniel 2015년 3월 4일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

per isakson
per isakson 2015년 3월 4일
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

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by