Suppose I have an array, a = [2 5 4 7]. What is the function returning the maximum value and its index?
a = [2 5 4 7]
For example, in my case that function should ret
3D case
Modifying Mohsen's answer for 3D array:
[M,I] = max (A(:)); [ind1, ind2, ind3] = ind2sub(size(A),I)