フィルターのクリア

How can I find the maximum value in a matrix?

45 ビュー (過去 30 日間)
Ayob
Ayob 2013 年 6 月 14 日
How can I find the maximum value in a matrix and find its column and row number of this value?

採用された回答

Andrei Bobrov
Andrei Bobrov 2013 年 6 月 14 日
A = randi(100,7,6); % your matrix
v = max(A(:)); % value
[ii,jj] = find(A == v); % row and column number

その他の回答 (1 件)

Image Analyst
Image Analyst 2013 年 6 月 14 日
maxValue = max(yourMatrix);
[row column] = find(yourMatrix==maxValue);
Or you can take the second returned argument from max() and use ind2sub().

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by