% Get day number for output
clear;clc;close all

time1=(datenum(1993,01,01):datenum(2012,12,31));
time2=datestr(time1,23);

year=[1993:2012];
jan_days=[];
jul_days=[]; 

for yy=1:length(year);
ind_jan=find(time1>=datenum(year(yy),01,01) & time1<=datenum(year(yy),02,01)-1);
jan_days(yy,1)=min(ind_jan);
jan_days(yy,2)=max(ind_jan);
ind_jul=find(time1>=datenum(year(yy),07,01) & time1<=datenum(year(yy),08,01)-1);
jul_days(yy,1)=min(ind_jul);
jul_days(yy,2)=max(ind_jul);
end 

% Check 
ref_date=datenum(1993,01,01)-1;
temp1=jan_days+ref_date;
jan_days2=datestr(temp1(:,1),23);
jan_days2(:,:,2)=datestr(temp1(:,2),23);
temp1=jul_days+ref_date;
jul_days2=datestr(temp1(:,1),23);
jul_days2(:,:,2)=datestr(temp1(:,2),23);

whos jan_days jul_days 








