Clear Filters
Clear Filters

Monthly to annual totals

1 view (last 30 days)
Anna
Anna on 23 Jan 2012
Hello,
I am hoping to convert monthly totals to annual totals using a loop. However, instead of using the calendar year (Jan-Dec) I want to use the water year which runs from October to September. I have a number of time series organised in a structure (468 rows, 1 column) starting from Oct 1960 and ending in Sept 1999.
I have attempted to sum up each 12 consecutive rows (1:12, 13:24 and so on) to get the annual totals but my code (below) is not doing the job (I am not sure what exactly it is doing) and I was hoping I could get some help fixing it. Many thanks!
for k=1:length(varnames)
p=0;
for i=1:39
for months=1:12
p=p+1;
annual_flow.(varnames{k})(i,1)=flow_monthly.(varnames{k})(p,1);
end
end
end

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!