MATLAB: How to average hourly data set.

I have a three dimensional matrix 180*360*3456
3456 represents time series of 36 years. this is hourly data set, in every month 8 times observations (3:00, 6:00, 9:00, 12:00 15:00, 18:00, 21:00, 00:00) were taken. 8*12=96; 96*36=3456 now I want to take average of each eight hours (3:00, 6:00, 9:00, 12:00 15:00, 18:00, 21:00, 00:00) which will represent a average value of a month. final dimension of matrix will be 180*360*432 (12*36=432). please suggest me a MATLAB code.

Best Answer

Hi,
I admit I have no idea where the 180*360 comes from in your "final dimension". But to compute the mean value of each block of 8 samples is easy:
A = rand(3456,1);
% convert to matrix with 8 rows:
A = reshape(A, 8, numel(A)/8);
% the mean now computes the mean for each column:
Amean = mean(A);
Now you have the mean values and can use e.g. repmat if you want to have e.g. 24 hours of each value ...
Titus