MATLAB: How to reshape data with leap year

daily to yearlyleapday includedreshape

I have 30 years daily data. For reason, i want to reshape the data as days*years (e.g. 365/366, 30). for the year with no leap day it would be easy (reshape(Data,365,[]). how one would do it with leap day included?. see the code I tried but is not working. the data I have is from 1981-2010.
Data=(1:10957)';
R=reshape(Data,[],30); % of course it wont work because of the dimensions

Best Answer

No need to reshape. Use timetables.
then you can simply use
yearlymeantable = retime(yourtimetable,'yearly','mean')
Related Question