MATLAB: How to calculate the mean of multiple matrices (with different size)

matrixmean

Hi all
I have multiple matrices, where the second dimension is of different size for each matrix. Here I add an example: Matrix A (128 x 2337) Matrix B (128 x 2828) Matrix C (128 x 2067)
Now I would like to calculate the mean over the second dimension over all matrices, so that the resulting averaged matrix for example looks like Matrix D (128 x 2000).
This may probably require to normalize the second dimension?
How would you do it? Many thanks in advance! Any tip is very appreciated. Liso

Best Answer

The mean over the second dimension is
theMeanA = mean(matrixA, 2);
theMeanB = mean(matrixB, 2);
theMeanC = mean(matrixC, 2);
These are all 128 by 1 column vectors. So, now, how exactly are you expecting to arrive at D which is a 128 by 2000 matrix? Do you have 2000 matrices that you are going to take the mean of?