Find the largest element and its location in a 3 dimensional array
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Israa Ahmed
am 8 Aug. 2021
Kommentiert: Walter Roberson
am 8 Aug. 2021
How to find the largest element and its location in case of a 3 dimensional array in Matlab?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 8 Aug. 2021
Bearbeitet: Walter Roberson
am 8 Aug. 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 Kommentare
Weitere Antworten (0)
Siehe auch
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!