フィルターのクリア

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 Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by