Effacer les filtres
Effacer les filtres

How can I find the maximum value in a matrix?

45 vues (au cours des 30 derniers jours)
Ayob
Ayob le 14 Juin 2013
How can I find the maximum value in a matrix and find its column and row number of this value?

Réponse acceptée

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

Plus de réponses (1)

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

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by