I need help on finding the max & min values of a 3d array.
Afficher commentaires plus anciens
I need help on finding the max & min values of a 3d array.
Réponse acceptée
Plus de réponses (1)
John D'Errico
le 8 Fév 2022
Modifié(e) : John D'Errico
le 8 Fév 2022
min and max are not sufficient? For example:
A = randi(1000,[4 3 2])
[maxval,maxind] = max(A,[],'all')
So 954 is the largest value. It occurs where? At the 20th element of A. That is, if the elements of A were strung out in a single vector as they are stored in memory. What subscripts does that correspond to?
[irow,icol,ipage] = ind2sub(size(A),maxind)
4th row. 2nd column, 2nd page.
Min works the same way. Ok, it finds the min, not the max, so not exactly the same way. :)
Catégories
En savoir plus sur Elementary Math dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!