0001 function t=tstr2date(time)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 f=find(time=='-');
0019 time(f)=':';
0020
0021 f=find(time==':');
0022
0023 if (length(f)<4)
0024 error('Invalid time')
0025 end
0026
0027 f=[0 f length(time)+1];
0028 for i=2:length(f)
0029 if (i==3)
0030 c{i-1}=time(f(2)+1:f(3)-1);
0031 c{i-1}=upper(c{i-1});
0032 else
0033 c{i-1}=str2num(time(f(i-1)+1:f(i)-1));
0034 end
0035 end
0036
0037 cnt=length(c);
0038 dif=6-cnt;
0039 if (dif)
0040 for i=1:dif
0041 c{cnt+i}=0;
0042 end
0043 end
0044
0045 t.day=c{1};
0046 t.month=c{2};
0047 t.year=c{3};
0048 t.hour=c{4};
0049 t.min=c{5};
0050 t.sec=c{6};