Filter löschen
Filter löschen

How can I find the maximum value in a matrix?

81 Ansichten (letzte 30 Tage)
Ayob
Ayob am 14 Jun. 2013
How can I find the maximum value in a matrix and find its column and row number of this value?

Akzeptierte Antwort

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

Weitere Antworten (1)

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

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by