MATLAB: Averaging Every Element of some matrices

matrix manipulation

I have 40 matrices of 12×1. How can I take the the each element of every matrix and get a averaged matrix which will be 12×1

Best Answer

The simple answer is to concatenate all of your matrices into one array, and then use mean. Of course all of your matrices should be in one cell array, because that makes them much easier to work with:
C{1} = [..];
C{2} = [..];
..
C{40} = [..];
A = cat(3,C{:});
M = mean(A,3)