MATLAB: How to convert a 8760X30matrix to a 365X30 matrix

dayhoursubsample

I have a 8760X30 matrix and I want to convert this matrix to 365X30 matrix.
Every values in the row indicates a value in hour and now by take average of every 24 values, I want to have the day matrix.
Can anybody help me with it??

Best Answer

>> inp = rand(8760,30); % fake data matrix
>> out = mean(permute(reshape(inp,24,[],30),[2,3,1]),3);
And checking:
>> size(out)
ans =
365 30
>> isequal(mean(inp(1:24,:),1),out(1,:))
ans = 1
Related Question