How to Plot seasonal variations using a for loop
Show older comments
Hi everyone, i have representative concentration pathway data from the IPCC. the data is arranged: 1890 jan feb march april may.. ... 2100 so a column for year and 12 rows (one number in each) for each year. Im trying to work out winter mean over the time period, however december is located in the previous line to jan and feb. How can i code this in the for loop? for the others i have used: for i= 1:240 spring(i)= mean(data(i,3:5)) Thanks Ben
Answers (1)
Rik
on 15 Nov 2017
0 votes
Convert the subs of jan-mar to indices (see doc sub2ind), subtract 1, and there you are. Don't forget to add a special case for the first year.
I don't have time right now to write some example code, so let me know if this explanation is enough to get you going.
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!