Mercurial > hg > ltpda
diff m-toolbox/classes/@plist/getPropertyForKey.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@plist/getPropertyForKey.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,31 @@ +% GETPROPERTY get a property from a specified parameter. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: GETPROPERTY get a property from a specified parameter. If +% the property name exists then it returns the value otherwise +% an empty array ([]). +% +% CALL: obj = obj.getProperty(key, propertyName); +% +% INPUTS: key: Key for the parameter +% propertyName: Property name of the value +% +% VERSION: $Id: getPropertyForKey.m,v 1.1 2009/07/14 16:13:20 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function val = getPropertyForKey(obj, key, propertyName) + + if nargin ~= 3 + error('### This method works only with three inputs.'); + end + + val = []; + for ii = 1:numel(obj.params) + if strcmpi(obj.params(ii).key, key) + val = obj.params(ii).getProperty(propertyName); + break; + end + end + +end