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 data2D object. idx - index of the data samples M-FILE INFO: Get information about this methods by calling >> tsdata.getInfo('getX') Get information about a specified set-plist by calling: >> tsdata.getInfo('getX', 'None') VERSION: $Id: getX.m,v 1.4 2008/09/04 15:29:32 ingo Exp $ HISTORY: 27-05-2008 Diepholz Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % GETX Get the property 'x'. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: Get the property 'x'. 0005 % 0006 % CALL: val = obj.getX(); 0007 % val = obj.getX(idx); 0008 % val = obj.getX(1:10); 0009 % 0010 % INPUTS: obj - must be a single data2D object. 0011 % idx - index of the data samples 0012 % 0013 % M-FILE INFO: Get information about this methods by calling 0014 % >> tsdata.getInfo('getX') 0015 % 0016 % Get information about a specified set-plist by calling: 0017 % >> tsdata.getInfo('getX', 'None') 0018 % 0019 % VERSION: $Id: getX.m,v 1.4 2008/09/04 15:29:32 ingo Exp $ 0020 % 0021 % HISTORY: 27-05-2008 Diepholz 0022 % Creation 0023 % 0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0025 0026 function varargout = getX(varargin) 0027 0028 %%% Check if this is a call for parameters 0029 if utils.helper.isinfocall(varargin{:}) 0030 varargout{1} = getInfo(varargin{3}); 0031 return 0032 end 0033 0034 obj = varargin{1}; 0035 0036 idx = []; 0037 if nargin > 1 0038 if isnumeric(varargin{2}) || strcmpi(varargin{2}, 'end') 0039 idx = varargin{2}; 0040 else 0041 error('### Unknown arguments to getX.'); 0042 end 0043 end 0044 if isempty(obj.x) && ~isempty(obj.y) 0045 x = 0:1/obj.fs:obj.nsecs-1/obj.fs; %linspace(0, obj.nsecs-1/obj.fs, obj.nsecs*obj.fs); 0046 else 0047 x = obj.x; 0048 end 0049 0050 % % transpose x? 0051 % sx = size(x); 0052 % sy = size(obj.y); 0053 % if numel(x) == numel(obj.y) && sx(1) ~= sy(1) 0054 % x = x.'; 0055 % end 0056 0057 % return always a column vector 0058 if size(x,1) == 1 0059 x = x.'; 0060 end 0061 0062 if ~isempty(idx) 0063 if strcmpi(idx, 'end') 0064 x = x(end); 0065 else 0066 x = x(idx); 0067 end 0068 end 0069 0070 varargout{1} = x; 0071 0072 end 0073 0074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0075 % Local Functions % 0076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0077 0078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0079 % 0080 % FUNCTION: getInfo 0081 % 0082 % DESCRIPTION: Get Info Object 0083 % 0084 % HISTORY: 11-07-07 M Hewitson 0085 % Creation. 0086 % 0087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0088 0089 function ii = getInfo(varargin) 0090 if nargin == 1 && strcmpi(varargin{1}, 'None') 0091 sets = {}; 0092 pl = []; 0093 else 0094 sets = {'Default'}; 0095 pl = getDefaultPlist; 0096 end 0097 % Build info object 0098 ii = minfo(mfilename, 'tsdata', '', utils.const.categories.internal, '$Id: getX.m,v 1.4 2008/09/04 15:29:32 ingo Exp $', sets, pl); 0099 end 0100 0101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0102 % 0103 % FUNCTION: getDefaultPlist 0104 % 0105 % DESCRIPTION: Get Default Plist 0106 % 0107 % HISTORY: 11-07-07 M Hewitson 0108 % Creation. 0109 % 0110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0111 0112 function plo = getDefaultPlist() 0113 plo = plist(); 0114 end 0115