I have a 4D array of measurements in MATLAB. Each dimension represents a different parameter for the measurement. I want to find the maximum and minimum value and the index (i.e. which parameter) of each.
What’s the best way to do it? I figure I can take the max of the max of the max in each dimension, but that seems like a kludge.
Quick example:
Finding the minimum is left as an exercise :).
Following a comment:
If you do not know the number of dimensions of your array A and cannot therefore write the “
[i,j,k,l] =” part, use this trick: