I'm having trouble trying to find the min and max of this matrix. So far I can only get it to display the min which is -12, but it doesn't display the max at all, it just shows the entire matrix when I try to display the max. Any help is appreciated, thank you.
mat2=[-1 0 2;7 -4 12;4 8.2 11;-11 0 -12];n=size(mat2);max=mat2;min=mat2;for i=1:1:n(1); for j=1:1:n(2); if(mat2(i,j)>max); max=mat2(i,j); else(mat2(i,j)<min); min=mat2(i,j); end endendmax min
Best Answer