Mercurial > hg > ltpda
comparison m-toolbox/classes/@param/getProperty.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 % GETPROPERTY get a property from a parameter. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: GETPROPERTY get a property from a parameter. If the property | |
5 % name exists then it returns the value otherwise an empty | |
6 % array ([]). | |
7 % | |
8 % CALL: obj = obj.getProperty(propertyName); | |
9 % | |
10 % INPUTS: propertyName: Property name of the paramValue object | |
11 % | |
12 % VERSION: $Id: getProperty.m,v 1.2 2011/02/22 15:42:25 hewitson Exp $ | |
13 % | |
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
15 | |
16 function val = getProperty(obj, propertyName) | |
17 | |
18 if nargin ~= 2 | |
19 error('### This method works only with two inputs.'); | |
20 end | |
21 | |
22 if ~isa(obj.val, 'paramValue') | |
23 val = []; | |
24 return | |
25 end | |
26 | |
27 if ~isempty(obj.val) | |
28 if isfield(obj.val.property, propertyName) | |
29 val = obj.val.property.(propertyName); | |
30 else | |
31 val = []; | |
32 end | |
33 else | |
34 val = []; | |
35 end | |
36 | |
37 end |