필터 지우기
필터 지우기

how to find matrix indices

조회 수: 1 (최근 30일)
sowndharya
sowndharya 2013년 3월 8일
k=1:2; t=1:2; x(k,t)=[1.2 1.3;1.8 1.5] max(x) I have entered input x and found max(x).For what value of k and t , x is maximum ?How to find this using matlab code?

채택된 답변

Wayne King
Wayne King 2013년 3월 8일
편집: Wayne King 2013년 3월 8일
Do you want the single biggest element in the matrix? If so then, just max() will not give you that. You'll get a row vector of the largest elements in each column.
X = [1.2 1.3;1.8 1.5];
[val,idx] = max(X(:));
[I,J] = ind2sub(size(X),idx);
X(I,J)
is the largest element.
  댓글 수: 1
sowndharya
sowndharya 2013년 3월 14일
I want max value in every column so i have used max command .That was helpful.but i want to find the next maximum value in all the columns.This process have to be repeated till finding the least value in that column.i mean in descending order.for ex x=[1 2 3;4 5 6;7 8 9] max(x) will give (1 4 7) [x,y]=max(x) y gives (1 1 1) (indices)
next i have to find next max (2,5,8) the indices i should get (2 2 2) what command i should use?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by