Getting element row and column (index location) out of a matrix?

조회 수: 22 (최근 30일)
ARS
ARS 2013년 6월 4일
Hi,
I have a correlation output matrix which I obtain through function
*Resultant= Corr(x)*
Let Resultant be a 10x10 matrix.
I wish to extract the location (row and column number) of the top 5 values from the Resultant matrix.
All help will be appreciated.
Regards,
AMD.

채택된 답변

Iman Ansari
Iman Ansari 2013년 6월 4일
Resultant=rand(10,10);
[B,IX] = sort(Resultant(:),'descend')
[r c] = ind2sub(size(Resultant),IX(1:5))

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by