comparison m-toolbox/classes/@param/getVal.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 % GETVAL returns the default value of a param.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: GETVAL returns the default value of a param
5 %
6 % CALL: val = getVal(param);
7 %
8 % VERSION: $Id: getVal.m,v 1.7 2011/02/22 15:42:33 hewitson Exp $
9 %
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 function varargout = getVal(varargin)
13
14 pin = varargin{1};
15
16 if numel(pin) ~= 1 || nargin ~= 1
17 error('### This method works only with one param object. It might be that the PLIST have two parameter with the key [%s]', pin(1).key);
18 end
19
20 if isa(pin.val, 'paramValue') && ~isempty(pin.val) && (pin.val.valIndex >= 1)
21 varargout{1} = pin.val.options{pin.val.valIndex};
22 return;
23 end
24
25 varargout{1} = pin.val;
26
27 end