MATLAB: Is it possible to find the max value and position within the multidimensional array

maxmultidimensional array

A(:,:,1) = [1,1,1;2,2,9;3,3,3;6,0,0]
A(:,:,2) = [4,5,4;5,5,5;6,0,0;6,0,0]
A(:,:,3) = [4,5,4;5,5,5;6,0,0;16,0,0]

Best Answer

[val,idx]=max(A(:))
[r,c,i]=ind2sub(size(A),idx)
r gives you row number, c gives you column number and i gives you the multidimensional array, which is 3 in this case.