Effacer les filtres
Effacer les filtres

Locating matrix position of maximum value

2 vues (au cours des 30 derniers jours)
John
John le 16 Sep 2011
I have a large matrix with many numbers. I would like to calculate the max and min values as well as the cell location (m,n) of each of these values. How can I do this?

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 16 Sep 2011
Use the full return argument of min and max
[Y,I] = MAX(X)
a=magic(10);
[Value,Ind]=max(a(:))
[M,N]=ind2sub(size(a),Ind)
  1 commentaire
Andrei Bobrov
Andrei Bobrov le 16 Sep 2011
http://www.mathworks.com/matlabcentral/answers/15806-returning-largest-and-smallest-values-in-the-array

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by