Mercurial > hg > ltpda
comparison m-toolbox/classes/@xyzdata/xyzdata.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % XZYDATA X-Y-Z data object class constructor. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: XZYDATA X-Y-Z data object class constructor. | |
5 % Create an X-Y-Z data object. | |
6 % | |
7 % SUPER CLASSES: data3D < data2D < ltpda_data < ltpda_nuo < ltpda_obj | |
8 % | |
9 % CONSTRUCTORS: | |
10 % xyz = xyzdata() - creates a blank xyz object | |
11 % xyz = xyzdata(z) - creates an xyz object with the given | |
12 % z-data. | |
13 % xyz = xydata(x,y,z) - creates an xyz object with the given | |
14 % (x,y,z)-data. | |
15 % | |
16 % VERSION: $Id: xyzdata.m,v 1.29 2011/03/30 13:17:33 mauro Exp $ | |
17 % | |
18 % SEE ALSO: tsdata, fsdata, xydata, cdata, data2D, data3D, xyzdata | |
19 % | |
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
21 | |
22 classdef (Hidden = true) xyzdata < data3D | |
23 | |
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
25 % Property definition % | |
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
27 | |
28 %---------- Public (read/write) Properties ---------- | |
29 properties | |
30 end | |
31 | |
32 %---------- Protected read-only Properties ---------- | |
33 properties (GetAccess = public, SetAccess = protected) | |
34 end | |
35 | |
36 %---------- Private Properties ---------- | |
37 properties (GetAccess = protected, SetAccess = protected) | |
38 end | |
39 | |
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
41 % Check property setting % | |
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
43 | |
44 methods | |
45 end | |
46 | |
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
48 % Constructor % | |
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
50 | |
51 methods | |
52 function obj = xyzdata(varargin) | |
53 | |
54 switch nargin | |
55 case 0 | |
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
57 %%%%%%%%%%%%%%%%%%%%%%%%%%% no inputs %%%%%%%%%%%%%%%%%%%%%%%%%%% | |
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
59 | |
60 case 1 | |
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
62 %%%%%%%%%%%%%%%%%%%%%%%%%%% one input %%%%%%%%%%%%%%%%%%%%%%%%%%% | |
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
64 | |
65 if isa(varargin{1}, 'xyzdata') | |
66 %%%%%%%%%% xy = xydata(xydata) %%%%%%%%%% | |
67 obj = copy(varargin{1}, 1); | |
68 | |
69 elseif isstruct(varargin{1}) | |
70 %%%%%%%%%% data = xyzdata(struct) %%%%%%%%%% | |
71 obj = fromStruct(obj, varargin{1}); | |
72 | |
73 elseif isnumeric(varargin{1}) && length(varargin{1}) > 1 | |
74 %%%%%%%%%% xyz = xyzdata(z_vector) %%%%%%%%%% | |
75 obj.x = 1:size(varargin{1}, 1); | |
76 obj.y = 1:size(varargin{1}, 2); | |
77 obj.z = varargin{1}; | |
78 | |
79 elseif isa(varargin{1}, 'plist') | |
80 %%%%%%%%%% ts = xydata(plist) %%%%%%%%%% | |
81 if nparams(varargin{1}) == 0 | |
82 % return empty object | |
83 else | |
84 error('### Unknown xyzdata constructor method.'); | |
85 end | |
86 | |
87 else | |
88 error('### Unknown xyzdata constructor method with one argument.'); | |
89 end | |
90 | |
91 case 2 | |
92 | |
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
94 %%%%%%%%%%%%%%%%%%%%%%%%%%%% two input %%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
96 | |
97 if isa(varargin{1}, 'org.apache.xerces.dom.DeferredElementImpl') && ... | |
98 isa(varargin{2}, 'history') | |
99 %%%%%%%%%% obj = xyzdata(DOM node, history-objects) %%%%%%%%%% | |
100 obj = fromDom(obj, varargin{1}, varargin{2}); | |
101 | |
102 else | |
103 error('### Unknown constructor method for two inputs.'); | |
104 end | |
105 | |
106 case 3 | |
107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
108 %%%%%%%%%%%%%%%%%%%%%%%%%% three input %%%%%%%%%%%%%%%%%%%%%%%%%% | |
109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
110 | |
111 obj.x = varargin{1}; | |
112 obj.y = varargin{2}; | |
113 obj.z = varargin{3}; | |
114 otherwise | |
115 error('### Unknown number of constructor arguments.'); | |
116 end | |
117 | |
118 %%%%%%%%%% Normalize the the x- and y-vector %%%%%%%%%% | |
119 | |
120 nx = size(obj.z, 2); | |
121 ny = size(obj.z, 1); | |
122 | |
123 if length(obj.x) ~= nx | |
124 error('### X-vector has wrong length.'); | |
125 end | |
126 if length(obj.y) ~= ny | |
127 error('### Y-vector has wrong length.'); | |
128 end | |
129 | |
130 end % End constructor | |
131 end % End public methods | |
132 | |
133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
134 % Methods (Public, hidden) % | |
135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
136 | |
137 methods (Hidden = true) | |
138 varargout = attachToDom(varargin) | |
139 end | |
140 | |
141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
142 % Methods (protected) % | |
143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
144 | |
145 methods (Access = protected) | |
146 varargout = fromStruct(varargin) | |
147 varargout = fromDom(varargin) | |
148 end | |
149 | |
150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
151 % Methods (private) % | |
152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
153 | |
154 methods (Access = private) | |
155 end | |
156 | |
157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
158 % Methods (static) % | |
159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
160 methods (Static) | |
161 | |
162 function out = VEROUT() | |
163 out = '$Id: xyzdata.m,v 1.29 2011/03/30 13:17:33 mauro Exp $'; | |
164 end | |
165 | |
166 function ii = getInfo(varargin) | |
167 ii = utils.helper.generic_getInfo(varargin{:}, 'xyzdata'); | |
168 end | |
169 | |
170 function out = SETS() | |
171 out = {'Default'}; | |
172 end | |
173 | |
174 function out = getDefaultPlist(set) | |
175 switch lower(set) | |
176 case 'default' | |
177 out = plist(); | |
178 otherwise | |
179 error('### Unknown set [%s]', set'); | |
180 end | |
181 end | |
182 | |
183 function obj = initObjectWithSize(n,m) | |
184 obj = xyzdata.newarray([n m]); | |
185 end | |
186 | |
187 end % End static methods | |
188 | |
189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
190 % Methods (static, private) % | |
191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
192 | |
193 methods (Static, Access = private) | |
194 end % End static, private methods | |
195 | |
196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
197 % Methods (static, hidden) % | |
198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
199 | |
200 methods (Static = true, Hidden = true) | |
201 varargout = loadobj(varargin) | |
202 varargout = update_struct(varargin); | |
203 end | |
204 | |
205 end % End classdef |