view m-toolbox/classes/@tsdata/getX.m @ 52:daf4eab1a51e
database-connection-manager tip
Fix. Default password should be [] not an empty string
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Wed, 07 Dec 2011 17:29:47 +0100 (2011-12-07)
parents
f0afece42f48
children
line source
+ − % GETX Get the property 'x'.
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % DESCRIPTION: Get the property 'x'.
+ − %
+ − % CALL: val = obj.getX();
+ − % val = obj.getX(idx);
+ − % val = obj.getX(1:10);
+ − %
+ − % INPUTS: obj - must be a single tsdata object.
+ − % idx - index of the data samples
+ − %
+ − % VERSION: $Id: getX.m,v 1.13 2011/07/05 06:32:40 mauro Exp $
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ −
+ − function x = getX(obj, idx)
+ −
+ − ly = length(obj.y);
+ − sx = size(obj.x);
+ − ts = 1/obj.fs;
+ − if sx(1) == 0 && sx(2) == 0 && ly>0
+ − x = 0:ts:obj.nsecs-ts; %linspace(0, obj.nsecs-1/obj.fs, obj.nsecs*obj.fs);
+ − else
+ − x = obj.x;
+ − end
+ −
+ − % return always a column vector
+ − if size(x,1) == 1
+ − x = x.';
+ − end
+ −
+ − % add the toffset
+ − x = x + obj.toffset / 1000;
+ −
+ − % We can have rounding errors for strange sample rates and Nsecs
+ − if length(x) < ly
+ − while length(x) < ly
+ − x = [x; x(end)+ts];
+ − end
+ − end
+ −
+ − if length(x) ~= ly
+ − x = x(1:length(obj.y));
+ − end
+ −
+ − if nargin == 2
+ − if strcmpi(idx, 'end')
+ − x = x(end);
+ − else
+ − x = x(idx);
+ − end
+ − end
+ −
+ − end
+ −