MATLAB: How to take an average of three dimensional data

MATLAB

Hi,
I have a three-dimensional matrix (360 x 720 x 60), in this matrix 60 represents monthly data of 5yeras (for example monthly temperature). I want to take the annual average of these monthly values so that the final matrix will be 360 x 720 x 5.

Best Answer

x = your 3D matrix
result = mean(reshape(x,360,720,12,5),3);