What i would like to do is compare multiple matrices (up to ten), and find the maximum value in the first element of the matrices. Then the maximum value will be replaced, so i will get a new matrix consisting of only max values.
I would like to do this in a for loop since the matrices will change after each experiment i do.
so far i have done the following, where i have three(A,B and C) matrices that are 4×4:
c=zeros(4,4,3) # preallokc(1:4,1:4,1)=Ac(1:4,1:4,2)=Bc(1:4,1:4,3)=C
I now have a 3x3x4 stack
MaxVal=max(c,[],3)
This does what i want. I am fairly new at Matlab and i can't do this in a for loop. Please help, thank you
Best Answer