Mercurial > hg > ltpda
comparison m-toolbox/classes/@ltpda_data/setYunits.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 % SETYUNITS Set the property 'yunits'. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: Set the property 'yunits'. | |
5 % | |
6 % CALL: obj.setYunits('units'); | |
7 % obj = obj.setYunits('units'); create copy of the object | |
8 % | |
9 % INPUTS: obj - must be a single ltpda_data (cdata, data2D, data3D) object. | |
10 % units - unit object or a valid string which can be transformed | |
11 % into a unit object. | |
12 % | |
13 % VERSION: $Id: setYunits.m,v 1.5 2011/09/02 11:05:24 ingo Exp $ | |
14 % | |
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
16 | |
17 function varargout = setYunits(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 'yunits' | |
26 if isempty(val) | |
27 obj.yunits = unit(); | |
28 elseif ischar(val) | |
29 obj.yunits = unit(val); | |
30 elseif iscell(val) | |
31 obj.yunits = val{1}; | |
32 else | |
33 obj.yunits = val; | |
34 end | |
35 | |
36 varargout{1} = obj; | |
37 end | |
38 |