


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.m,v 1.6 2007/11/30 19:36:05 ingo 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.m,v 1.6 2007/11/30 19:36:05 ingo Exp $ 0012 % 0013 % HISTORY: 31-01-2007 M Hewitson 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 VERSION = '$Id: setTime.m,v 1.6 2007/11/30 19:36:05 ingo Exp $'; 0019 0020 if nargin == 2 && isa(ts, 'tsdata') && ischar(varargin{1}) 0021 if strcmp(varargin{1}, 'Params') 0022 ts = plist(); 0023 return 0024 elseif strcmp(varargin{1}, 'Version') 0025 ts = VERSION; 0026 return 0027 end 0028 end 0029 0030 ts.x = linspace(0, ts.nsecs-1/ts.fs, length(ts.y)); 0031 ts = reshapeT(ts); 0032 0033 % END