SETTIME sets the time-vector of a tsdata object based on the length of the x vector and the sample rate. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: SETTIME sets the time-vector of a tsdata object based on the length of the x vector and the sample rate. CALL: tsdata = setTime(tsdata) VERSION: $Id: setTime.html,v 1.14 2008/03/31 10:27:36 hewitson Exp $ HISTORY: 31-01-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function ts = setTime(ts, varargin) 0002 % SETTIME sets the time-vector of a tsdata object based on the length of the x vector and the sample rate. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: SETTIME sets the time-vector of a tsdata object based on the 0007 % length of the x vector and the sample rate. 0008 % 0009 % CALL: tsdata = setTime(tsdata) 0010 % 0011 % VERSION: $Id: setTime.html,v 1.14 2008/03/31 10:27:36 hewitson Exp $ 0012 % 0013 % HISTORY: 31-01-2007 M Hewitson 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 VERSION = '$Id: setTime.html,v 1.14 2008/03/31 10:27:36 hewitson Exp $'; 0019 CATEGORY = 'Internal'; 0020 0021 if nargin == 2 && isa(ts, 'tsdata') && ischar(varargin{1}) 0022 if strcmp(varargin{1}, 'Params') 0023 ts = plist(); 0024 return 0025 elseif strcmp(varargin{1}, 'Version') 0026 ts = VERSION; 0027 return 0028 elseif strcmp(varargin{1}, 'Category') 0029 ts = CATEGORY; 0030 return 0031 end 0032 end 0033 0034 ts.x = linspace(0, ts.nsecs-1/ts.fs, length(ts.y)); 0035 ts = reshapeT(ts); 0036 0037 % END