grouping observations according to strng dates with no empties
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear all,
I have the following matrix named mdata1
OCT 2008' [NaN] [1.4574] [0.4591]
'NOV 2008' [NaN] [1.6081] [0.4998]
'DEC 2008' [NaN] [1.6766] [0.5116]
'JAN 2009' [NaN] [1.5795] [0.4760]
'FEB 2009' [NaN] [1.4387] [0.4379]
'MAR 2009' [NaN] [1.5567] [0.4614]
'APR 2009' [NaN] [1.6339] [0.4978]
'MAY 2009' [NaN] [1.6352] [0.5041]
'JUN 2009' [NaN] [1.7392] [0.5357]
'JUL 2009' [NaN] [1.5257] [0.4884]
'AUG 2009' [NaN] [1.7156] [0.5492]
'SEP 2009' [NaN] [1.6875] [0.5429]
'OCT 2009' [NaN] [1.4765] [0.4690]
'NOV 2009' [NaN] [1.5286] [0.4912]
'DEC 2009' [NaN] [1.5641] [0.5064]
'JAN 2010' [NaN] [1.5505] [0.4984]
'FEB 2010' [NaN] [1.6991] [0.4876]
'MAR 2010' [NaN] [1.6404] [0.4765]
'APR 2010' [NaN] [1.6155] [0.4783]
'MAY 2010' [NaN] [1.6134] [0.4773]
'JUN 2010' [NaN] [1.6587] [0.4810]
'JUL 2010' [NaN] [1.7085] [0.4907]
'AUG 2010' [NaN] [1.8470] [0.5257]
'SEP 2010' [NaN] [1.9507] [0.5615]
'OCT 2010' [NaN] [1.9028] [0.5447]
'NOV 2010' [NaN] [1.9179] [0.5291]
'DEC 2010' [NaN] [1.9390] [0.5459]
'JAN 2011' [NaN] [2.1162] [0.5763]
'FEB 2011' [NaN] [2.1370] [0.5751]
'MAR 2011' [NaN] [2.2240] [0.5968]
And I want to group all the observations that correspond to ' OCT 2008' , then all the observations that correspond to 'NOV 2008' , then all the observations that correspond to 'DEC 2008' and so forth . Similarly for the years 2009, 2010 and 2011
I am trying to use a code similar to the below one
[trash idx] = sortrows([cat(7,mdata1{:,1})datenum(mdata1(:,11),'mmm yyyy')],[2 1]);
zoi= mdata1(idx,:);
but I do not know how to fix it
2 commentaires
Oleg Komarov
le 28 Mai 2012
You have one observation for Oct 2008, Nov 2008 etc... Grouping involves multiple observations per group.
Please clarify or post an example of the desired output.
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dates and Time dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!