Mercurial > hg > ltpda
comparison m-toolbox/classes/@ltpda_uoh/setObjectProperties.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 % SETOBJECTPROPERTIES sets the object properties of an ltpda_uoh object. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: SETOBJECTPROPERTIES sets the object properties of an | |
5 % ltpda_uoh object from the input plist. | |
6 % | |
7 % Only the keys in plist which are actually object properties are used; | |
8 % other keys are ignored. | |
9 % | |
10 % CALL: objs.setObjectProperties(pl); | |
11 % objs.setObjectProperties(pl, exceptions); | |
12 % | |
13 % 'exceptions' should be a cell-array of property names which will be | |
14 % ignored (not set). | |
15 % | |
16 % <a href="matlab:utils.helper.displayMethodInfo('ltpda_uoh', 'setObjectProperties')">Parameters Description</a> | |
17 % | |
18 % VERSION: $Id: setObjectProperties.m,v 1.6 2011/09/16 05:01:46 hewitson Exp $ | |
19 % | |
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
21 | |
22 function varargout = setObjectProperties(varargin) | |
23 | |
24 % Get inputs | |
25 as = varargin{1}; | |
26 pl = varargin{2}; | |
27 | |
28 if nargin > 2 | |
29 exceptions = varargin{3}; | |
30 else | |
31 exceptions = {}; | |
32 end | |
33 | |
34 % Decide on a deep copy or a modify | |
35 bs = copy(as, nargout); | |
36 | |
37 % Loop over ltpda_uoh objects | |
38 props = properties(as); | |
39 keys = pl.getKeys; | |
40 | |
41 for kk=1:numel(keys) | |
42 key = lower(keys{kk}); | |
43 if utils.helper.ismember(key, exceptions) | |
44 % fprintf('- skipping setting %s\n', key); | |
45 elseif utils.helper.ismember(key, props) | |
46 % fprintf('+ setting property %s\n', key); | |
47 fcn = ['set' upper(key(1)) key(2:end)]; | |
48 if ismethod(bs, fcn) | |
49 feval(fcn, bs, pl.find(key)); | |
50 end | |
51 end | |
52 | |
53 end | |
54 | |
55 % Set output | |
56 varargout = utils.helper.setoutputs(nargout, bs); | |
57 end | |
58 |