0001 function fast_extract(file,dir)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 if(~exist('where.mat'))
0012 ind = 1
0013 else
0014 load where
0015 end
0016
0017 if(length(dir)<1)
0018 dir = '.'
0019 end
0020
0021 disp(dir);
0022
0023 if(~exist('file'))
0024 error('no schedule file')
0025 end
0026
0027 [start, stop, sched] = textread(file,'%s %s %s');
0028
0029 if ind>size(start,1)
0030 disp('Out of times')
0031 exit
0032 end
0033
0034 disp(sprintf('%s %s %s',start{ind},stop{ind},sched{ind}));
0035
0036
0037
0038
0039 t1=tstr2date(start{ind});
0040 t2=tstr2date(stop{ind});
0041
0042 if exist('lstop')
0043 situation=1;
0044
0045 nstart=lstop;
0046 t=tstr2date(lstop);
0047 t.hour=t.hour+1;
0048 if t.hour>23
0049 t.hour=t.hour-24;t.day=t.day+1;
0050 end
0051 nstop=date2tstr(t);
0052 lstop=nstop;lstart=nstart;
0053
0054
0055
0056 if tstr2mjd(nstop)>tstr2mjd(stop{ind})
0057 nstop=stop{ind};
0058 else
0059 save where ind lstop lstart
0060 end
0061
0062 else
0063 situation=2;
0064 nstart=start{ind};nstop=stop{ind};
0065 if (t1.day==t2.day&t1.hour+1<t2.hour)|(t1.day<t2.day&t2.hour-t1.hour+24>1)
0066 situation=3;
0067 nstart=start{ind};
0068 t=t1;t.hour=t.hour+1;
0069 if t.hour>23
0070 t.hour=t.hour-24;t.day=t.day+1;
0071 end
0072 nstop=date2tstr(t);
0073 lstop=nstop;lstart=nstart;
0074 save where ind lstop lstart
0075 end
0076 end
0077
0078
0079 dnew=read_arc(nstart,nstop);
0080
0081 switch situation
0082 case 1
0083 load temp
0084 d=catstruct(1,[d dnew]);
0085 save temp d
0086 case 2
0087 d=dnew;
0088 case 3
0089 d=dnew;
0090 save temp d
0091 end
0092
0093 if nstop==stop{ind}
0094 t=monthStr2num(tstr2date(start{ind}));
0095 eval(sprintf('save %s/%s_%.2d%s%.2d.mat d',dir,cell2mat(sched(ind)),t.year,cell2mat(getmonth(t.month)),t.day));
0096
0097
0098 ind=ind+1;
0099 save where ind
0100 end
0101
0102 exit
0103
0104 return