How can I find the maximum value in a matrix?

71 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by