Find the largest element and its location in a 3 dimensional array
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Israa Ahmed
le 8 Août 2021
Commenté : Walter Roberson
le 8 Août 2021
How to find the largest element and its location in case of a 3 dimensional array in Matlab?
0 commentaires
Réponse acceptée
Walter Roberson
le 8 Août 2021
Modifié(e) : Walter Roberson
le 8 Août 2021
[largest_value, idx] = max(YourArray, [], 'all', 'linear');
[row, col, page] = ind2sub(size(YourArray), idx);
In older releases you would probably use
[largest_value, idx] = max(YourArray(:));
[row, col, page] = ind2sub(size(YourArray), idx);
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Resizing and Reshaping Matrices 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!