Try this:
M = 10;
N = 15;
A1 = rand(M,N);
A2 = rand(M,N);
A3 = rand(M,N);
A4 = rand(M,N);
Acat = cat(3, A1, A2, A3, A4);
[Max,MaxIdx] = max(Acat, [], 3);
The ‘Max’ value is the value of the maximum amongst the matrices created y ‘Acat’, and ‘MaxIdx’ is the matrix with that value, correspoinding to the order in which you concatenated them.
Best Answer