Mercurial > hg > ltpda
comparison m-toolbox/classes/@data2D/setXunits.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 % SETXUNITS Set the property 'xunits'. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: Set the property 'xunits'. | |
5 % | |
6 % CALL: obj.setXunits('units'); | |
7 % obj = obj.setXunits('units'); create copy of the object | |
8 % | |
9 % INPUTS: obj - must be a single data2D object. | |
10 % units - unit object or a valid string which can be transformed | |
11 % into a unit object. | |
12 % | |
13 % VERSION: $Id: setXunits.m,v 1.10 2011/07/12 13:35:02 mauro Exp $ | |
14 % | |
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
16 | |
17 function varargout = setXunits(varargin) | |
18 | |
19 obj = varargin{1}; | |
20 val = varargin{2}; | |
21 | |
22 % decide whether we modify the object, or create a new one. | |
23 obj = copy(obj, nargout); | |
24 | |
25 % set 'xunits' | |
26 if isempty(val) | |
27 obj.xunits = unit(); | |
28 elseif ischar(val) | |
29 obj.xunits = unit(val); | |
30 elseif iscell(val) | |
31 obj.xunits = val{1}; | |
32 else | |
33 obj.xunits = val; | |
34 end | |
35 | |
36 varargout{1} = obj; | |
37 end | |
38 |