month2annual.m (361B)
1 function yA=month2annual(yM); 2 3 % function yA=month2annual(yM); 4 % 5 % Converts the monthly observations in yM to annual observations 6 % by averaging the values in the 12 months of the annual. 7 % 8 9 10 T=length(yM); 11 TA=floor(T/12); % Length of annually series 12 13 yA=zeros(TA,1)*NaN; 14 t=1; % index for montly data 15 16 for i=1:TA; 17 yA(i)=mean(yM(t:(t+11))); 18 t=t+12; 19 end;