MATLAB: Help with matrix manipulation in matlab

arrayaveragematrixmatrix arrayvector

I have a matrix M with dimension 600×500. I want to do an average of its values along vertical direction, in order to have a matrix with smaller dimension. For example, I want to obtain a matrix with dimension 200×500: this means that, every three values along each column, I take just one (which is the average of the three values). How can I do this ? Thanks!

Best Answer

out = squeeze(mean(reshape(M,3,[],size(M,2))));
Related Question