comparison m-toolbox/classes/@ssm/modelHelper_processInputPlist.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 % MODELHELPER_PROCESSINPUTPLIST processes the input parameters plists for
2 % the ssm models.
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % DESCRIPTION: MODELHELPER_PROCESSINPUTPLIST processes the input parameters plists for
6 % the ssm models.
7 %
8 % CALL: pl = modelHelper_processInputPlist(pl, defaultPlist)
9 %
10 % INPUTS:
11 % 'pl' - the user plist
12 % 'defaultPlist' - the model's default plist
13 %
14 % OUTPUTS:
15 %
16 % 'pl' - plist of model parameters.
17 %
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19 function pl = modelHelper_processInputPlist(pl, defaultPlist)
20
21 setNames = pl.find('param names');
22 setValues = pl.find('param values');
23
24 removePlParam = {};
25 for k=1:pl.nparams
26 loc_key = pl.params(k).key;
27 if ~defaultPlist.isparam( loc_key )
28 loc_value = pl.params(k).getVal;
29 if ~isa(loc_value, 'double') || numel(loc_value)~=1
30 warning(['### the ssm constructor tried to set the parameter ' loc_key ' as a numerical (double) physical parameter '...
31 ' because it is not in the default plist of this model. ' ...
32 'However it could not be done for the class "' class(loc_value) '" and the size [' num2str(size(loc_value)) ']. '...
33 'Please remove this parameter from your user plist.'])
34 else
35 setNames = [setNames {loc_key}]; %#ok<AGROW>
36 setValues = [setValues loc_value]; %#ok<AGROW>
37 removePlParam = [removePlParam loc_key ]; %#ok<AGROW>
38 end
39 end
40 end
41 pl.removeKeys(removePlParam);
42 pl.pset('param names', setNames);
43 pl.pset('param values', setValues);
44 end