function t=tvector(dt) get relative time vector from data set. converts the utc time of dt to units of type Inputs: dt - data timestamp type - 'min' 'sec' 'hour' example: t=tvector(d.array.frame.utc,'min')
0001 function t=tvector(dt,type) 0002 0003 % function t=tvector(dt) 0004 % 0005 % get relative time vector from data set. converts the utc time of dt 0006 % to units of type 0007 % 0008 % Inputs: 0009 % dt - data timestamp 0010 % type - 'min' 0011 % 'sec' 0012 % 'hour' 0013 % 0014 % example: 0015 % t=tvector(d.array.frame.utc,'min') 0016 0017 % make case insensitive 0018 type=lower(type); 0019 0020 switch type 0021 case 'min' 0022 conv=24*60; 0023 0024 case 'sec' 0025 conv=24*60*60; 0026 0027 case 'hour' 0028 conv=24; 0029 0030 otherwise 0031 t=[]; 0032 disp('Unrecognized type input') 0033 return 0034 end 0035 0036 t=dt-dt(1); 0037 t=t*conv; 0038 0039 0040