DATA2D is the abstract base class for 2-dimensional data objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: DATA2D is the base class for 2-dimensional data objects. This is an abstract class. SUPER CLASSES: ltpda_data < ltpda_nuo < ltpda_obj SUB CLASSES: xydata, tsdata, fsdata, data3D PROPERTIES: Inherit Properties (read only) version - cvs-version string. Protected Properties (read only) xunits - units of the x-axis yunits - units of the y-axis x - data values of the x-axis y - data values of the y-axis DATA2D METHODS: Public Methods char - returns one character string which represents the object setXunits - set the property 'xunits' setYunits - set the property 'yunits' setX - set the property 'x' setY - set the property 'y' setXY - set the property 'x' and 'y' getX - get the property 'x' getY - get the property 'y' applymethod - applys the given method to the input 2D data applyoperator - applys the given operator to the two input data objects VERSION: $Id: data2D.m,v 1.23 2008/09/07 18:11:58 hewitson Exp $ HISTORY: 09-06-2008 Hewitson Creation. SEE ALSO: ltpda_data, fsdata, tsdata, xydata, data3D %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % DATA2D is the abstract base class for 2-dimensional data objects. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: DATA2D is the base class for 2-dimensional data objects. This is 0005 % an abstract class. 0006 % 0007 % SUPER CLASSES: ltpda_data < ltpda_nuo < ltpda_obj 0008 % 0009 % SUB CLASSES: xydata, tsdata, fsdata, data3D 0010 % 0011 % PROPERTIES: 0012 % 0013 % Inherit Properties (read only) 0014 % version - cvs-version string. 0015 % 0016 % Protected Properties (read only) 0017 % xunits - units of the x-axis 0018 % yunits - units of the y-axis 0019 % x - data values of the x-axis 0020 % y - data values of the y-axis 0021 % 0022 % DATA2D METHODS: 0023 % 0024 % Public Methods 0025 % char - returns one character string which represents the object 0026 % setXunits - set the property 'xunits' 0027 % setYunits - set the property 'yunits' 0028 % setX - set the property 'x' 0029 % setY - set the property 'y' 0030 % setXY - set the property 'x' and 'y' 0031 % getX - get the property 'x' 0032 % getY - get the property 'y' 0033 % applymethod - applys the given method to the input 2D data 0034 % applyoperator - applys the given operator to the two input data objects 0035 % 0036 % VERSION: $Id: data2D.m,v 1.23 2008/09/07 18:11:58 hewitson Exp $ 0037 % 0038 % HISTORY: 09-06-2008 Hewitson 0039 % Creation. 0040 % 0041 % SEE ALSO: ltpda_data, fsdata, tsdata, xydata, data3D 0042 % 0043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0044 0045 classdef data2D < ltpda_data 0046 0047 0048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0049 % Property definition % 0050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0051 0052 %---------- Public (read/write) Properties ---------- 0053 properties 0054 end 0055 0056 %---------- Protected read-only Properties ---------- 0057 properties 0058 xunits = unit; 0059 yunits = unit; 0060 x = []; 0061 y = []; 0062 end 0063 0064 %---------- Private Properties ---------- 0065 properties (GetAccess = protected, SetAccess = protected) 0066 end 0067 0068 %---------- Abstract Properties ---------- 0069 properties (Abstract = true, SetAccess = protected) 0070 end 0071 0072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0073 % Check property setting % 0074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0075 0076 methods 0077 %--- Xunits 0078 function obj = set.xunits(obj, val) 0079 if ~ischar(val) && ~isa(val, 'unit') 0080 error('### The value for the property ''xunits'' must be a unit-object'); 0081 end 0082 if ischar(val) 0083 obj.xunits = unit(val); 0084 elseif isa(val, 'unit') 0085 obj.xunits = val; 0086 else 0087 error('### The xunits value must be a unit or a string'); 0088 end 0089 end 0090 %--- Yunits 0091 function obj = set.yunits(obj, val) 0092 if ~ischar(val) && ~isa(val, 'unit') 0093 error('### The value for the property ''yunits'' must be a unit-object'); 0094 end 0095 if ischar(val) 0096 obj.yunits = unit(val); 0097 elseif isa(val, 'unit') 0098 obj.yunits = val; 0099 else 0100 error('### The yunits value must be a unit or a string'); 0101 end 0102 end 0103 %--- X 0104 function obj = set.x(obj, val) 0105 if ~isempty(val) 0106 if ~isnumeric(val) || ~isvector(val) 0107 error('### The value for the property ''x'' must be a numeric vector'); 0108 end 0109 end 0110 obj.x = val; 0111 0112 sx = size(obj.x); 0113 sy = size(obj.y); 0114 if sx(1) == 1 && sy(1) ~= 1 0115 obj.x = obj.x.'; 0116 end 0117 if sx(2) == 1 && sy(2) ~= 1 0118 obj.x = obj.x.'; 0119 end 0120 0121 end 0122 %--- Y 0123 function obj = set.y(obj, val) 0124 if ~isempty(val) 0125 if ~isnumeric(val) || ~isvector(val) 0126 error('### The value for the property ''y'' must be a numeric vector'); 0127 end 0128 end 0129 if ~isempty(obj.y) && ((size(val,1) == 1 && size(obj.y,1) ~= 1) || (size(val,2) == 1 && size(obj.y,2) ~= 1)) 0130 val = val.'; 0131 end 0132 obj.y = val; 0133 0134 sx = size(obj.x); 0135 sy = size(obj.y); 0136 if sx(1) == 1 && sy(1) ~= 1 0137 obj.x = obj.x.'; 0138 end 0139 if sx(2) == 1 && sy(2) ~= 1 0140 obj.x = obj.x.'; 0141 end 0142 0143 end 0144 end 0145 0146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0147 % Constructor % 0148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0149 0150 methods 0151 function obj = data2D(varargin) 0152 0153 %%% Call superclass 0154 obj = obj@ltpda_data(varargin{:}); 0155 0156 %%%%%%%%%% Set dafault values %%%%%%%%%% 0157 if nargin == 1 0158 0159 if isstruct(varargin{1}) 0160 %%%%%%%%%% obj = data2D(struct) %%%%%%%%%% 0161 0162 %%% Set properties which are declared in this class 0163 data2D_struct = varargin{1}; 0164 0165 obj.xunits = unit(data2D_struct.xunits); 0166 obj.yunits = unit(data2D_struct.yunits); 0167 obj.x = data2D_struct.x; 0168 obj.y = data2D_struct.y; 0169 end 0170 end 0171 0172 %%% Check the right size of x and y 0173 if ~isempty(obj.x) 0174 if ~isequal(size(obj.x), size(obj.y)) 0175 error('### The x and y containers must be the same size (or x must be empty).'); 0176 end 0177 end 0178 0179 end % End constructor 0180 0181 end 0182 0183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0184 % Methods (public) % 0185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0186 0187 methods 0188 varargout = char(varargin) 0189 varargout = setXunits(varargin) 0190 varargout = setYunits(varargin) 0191 varargout = setX(varargin) 0192 varargout = setY(varargin) 0193 varargout = setXY(varargin) 0194 varargout = getX(varargin) 0195 varargout = getY(varargin) 0196 0197 varargout = applymethod(varargin) 0198 varargout = applyoperator(varargin) 0199 end 0200 0201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0202 % Methods (protected) % 0203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0204 0205 methods (Access = protected) 0206 end 0207 0208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0209 % Methods (public) % 0210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0211 0212 methods 0213 end 0214 0215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0216 % Methods (static) % 0217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0218 0219 methods (Static) 0220 0221 function ii = getInfo(varargin) 0222 ii = utils.helper.generic_getInfo(varargin{:}, 'data2D'); 0223 end 0224 0225 function out = VEROUT() 0226 out = '$Id: data2D.m,v 1.23 2008/09/07 18:11:58 hewitson Exp $'; 0227 end 0228 0229 function out = SETS() 0230 out = {}; 0231 end 0232 0233 function out = getDefaultPlist() 0234 out = []; 0235 end 0236 0237 end 0238 0239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0240 % Methods (abstract) % 0241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0242 0243 methods (Static) 0244 end 0245 0246 end 0247