MATLAB: Grid data into monthly average

average monthlygrid datareshape

Hello All,
I have a grid data set for 32 years (384 months) in the form A=(180*360*384), I want to find monthly average for the January. that means average for 32 years for January. I tried to reshape the data however, its not working, can somebody help me out here please?
I am trying with this
R=reshape (A,12,32)
However, i am getting error.
Thanks

Best Answer

You are on right track:
Use this:
% Making some sample random data
A=rand(180,360,384);
% reshaping
Areshaped=reshape(A,180,360,12,32);
% Averaging along the 4th dimension (year)
Amean=mean(Areshaped,4);
size(Amean)
180 360 12