how to reshape data with leap year?
Afficher commentaires plus anciens
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
4 commentaires
KL
le 19 Oct 2017
which version are you using?
Guillaume
le 19 Oct 2017
By definitions all columns of a matrix have the same number of rows. You can't have rows with 365 elements and others with 366 elements.
So what do you want to do? Fill up the last row of non-leap year with NaN? Store as a 1x30 cell array of 365x1 or 366x1 vectors?
Both will most likely make it harder to process your data than as it is now.
Hydro
le 19 Oct 2017
Walter Roberson
le 19 Oct 2017
Then there is the old "all entries with the same calendar date must appear in the same row", in which case you get NaN in the middle for each Feb 29 that is not present.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Calendar dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!