MATLAB: Find min or max value element from more than two matrices

calculationsmathematics

I know how we can find min or max value element from two matrices. For more than two matrices we can do two by two and then compare but I was wondering if there is any other simple way to find min or max value element from more than two matrices?

Best Answer

% data
matrix1=rand(2);
matrix2=rand(3);
matrix3=rand(4);
% engine
c=nan(4,4,3);
c(1:2,1:2,1)=matrix1;
c(1:3,1:3,2)=matrix2;
c(1:4,1:4,3)=matrix3;
% result
d=min(c,[],3)
e=max(c,[],3)