Daily values to monthly sums
Show older comments
Very silly issue I'm having, clearly it's Friday and my brain is dead!
I have yearly data (column 1 below is year, col 2 is DoY, col 3 is what I want, col 4 is a running ref #)
1999 88 -0.153775166948929 88
1999 89 0.0645182041737496 89
1999 90 0.305720459521316 90
1999 91 0.608267678784863 91
1999 92 -0.105377378067329 92
1999 93 0.164670217562409 93
1999 94 0.486056906589846 94
1999 95 -0.153775166948929 95
1999 96 0.0645182041737496 96
1999 97 0.305720459521316 97
1999 98 0.608267678784863 98
1999 99 -0.0388209349360338 99
1999 100 -0.0388209349360338 100
1999 101 -0.220461941261943 101
1999 102 -0.0576523900004068 102
1999 103 0.896360903826591 103
1999 104 0.842649481758915 104
1999 105 -0.347869165344918 105
What I want to do is pull out monthly totals of column 3. I wrote some indices:
%Monthly indexes
iJan=(1:1:31);
iFeb=(32:1:59);
iFebl=horzcat(iFeb,29);
iMar=(60:1:90);
iApr=(91:1:120);
iMay=(121:1:151);
iJun=(152:1:181);
iJul=(182:1:212);
iAug=(213:1:243);
iSep=(244:1:273);
iOct=(274:1:304);
iNov=(305:1:334);
iDec=(335:1:365);
I need monthly values for every month in my dataset. I keep on writing loops that do very silly things, please save my brain from friday frustration!
Accepted Answer
More Answers (1)
Chad Greene
on 30 Mar 2015
0 votes
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!