How to Plot seasonal variations using a for loop
Ältere Kommentare anzeigen
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
Antworten (1)
Rik
am 15 Nov. 2017
0 Stimmen
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.
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!