判断气象数据或其他数据年数据的处理
i=2011;
monthday0=[31,28,31,30,31,30,31,31,30,31,30,31];
monthday1=[31,29,31,30,31,30,31,31,30,31,30,31];
leapyear=rem(i,4); %年对4求余数 i是年
if leapyear>0
leap=0; %判断余数大于0,不能被4整除,则用leap标记这一年不是闰年(标记为0)
else
if rem(i,100)==0 && rem(i,400)~=0
leap=0; %能被4整除但是不能被400整除也不是闰年,则用leap标记这一年不是闰年
else
leap=1; %其他情况是闰年
end
end
if leap==1
month=monthday1';
days=366;
else
month=monthday0';
days=365;
end
he=1;
for i=1:12
day1=month(i,1);
month(i,1)=mean(daily(he:he+day1-1,1));
he=he+day1;
end