comparison m-toolbox/classes/@ssm/modelHelper_introScript.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 % header script for all ssm models
2 %% minfo call
3 if utils.helper.isinfocall(varargin{:})
4 varargout{1} = getInfo(varargin{3});
5 doNothing = true;
6 else
7 doNothing = false;
8
9 if nargin==2
10 if isa(varargin{1}, 'plist') && isa(varargin{2}, 'minfo')
11 %% constructor call
12 minfo_in = varargin{2};
13 pl = varargin{1};
14 if pl.isparam('set')
15 plDefault = getDefaultPlist(pl.find('set'));
16 else
17 plDefault = getDefaultPlist;
18 end
19 if ~pl.isparam('param names')
20 setNames = {};
21 setValues = [];
22 removePlParam = {};
23 for k=1:pl.nparams
24 loc_key = pl.params(k).key;
25 if ~plDefault.isparam( loc_key )
26 if ~strcmpi(loc_key, 'set')
27 loc_value = pl.params(k).getVal;
28 if ~isa(loc_value, 'double') || numel(loc_value)~=1
29 warning(['### the ssm constructor tried to set the parameter ' loc_key ' as a numerical (double) physical parameter '...
30 ' because it is not in the default plist of this model. ' ...
31 'However it could not be done for the class "' class(loc_value) '" and the size [' num2str(size(loc_value)) ']. '...
32 'Please remove this parameter from your user plist, if you do not use it.'])
33 else
34 setNames = [setNames loc_key]; %#ok<AGROW>
35 setValues = [setValues loc_value]; %#ok<AGROW>
36 removePlParam = [removePlParam loc_key ]; %#ok<AGROW>
37 end
38 end
39 end
40 end
41 pl.removeKeys(removePlParam);
42 pl.combine(plist('param names', setNames, 'symbolic params', setNames, 'param values', setValues));
43 end
44 pl = combine(varargin{1}, minfo_in.plists, plDefault);
45 varargout{2} = pl;
46 elseif isa(varargin{1}, 'char') && isa(varargin{2}, 'plist')
47 %% description only request
48 error('description call is deprecated')
49 else
50 error([mfilename ' needs one input argument of class plist and one minfo, but instead input argument was : ' class(varargin{1}) ' and ' class(varargin{2})])
51 end
52 else
53 error([mfilename ' needs two input arguments instead of ' num2str(numel(varargin))])
54 end
55 end
56