Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@ssm/modelHelper_introScript.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,56 @@ +% header script for all ssm models +%% minfo call +if utils.helper.isinfocall(varargin{:}) + varargout{1} = getInfo(varargin{3}); + doNothing = true; +else + doNothing = false; + + if nargin==2 + if isa(varargin{1}, 'plist') && isa(varargin{2}, 'minfo') + %% constructor call + minfo_in = varargin{2}; + pl = varargin{1}; + if pl.isparam('set') + plDefault = getDefaultPlist(pl.find('set')); + else + plDefault = getDefaultPlist; + end + if ~pl.isparam('param names') + setNames = {}; + setValues = []; + removePlParam = {}; + for k=1:pl.nparams + loc_key = pl.params(k).key; + if ~plDefault.isparam( loc_key ) + if ~strcmpi(loc_key, 'set') + loc_value = pl.params(k).getVal; + if ~isa(loc_value, 'double') || numel(loc_value)~=1 + warning(['### the ssm constructor tried to set the parameter ' loc_key ' as a numerical (double) physical parameter '... + ' because it is not in the default plist of this model. ' ... + 'However it could not be done for the class "' class(loc_value) '" and the size [' num2str(size(loc_value)) ']. '... + 'Please remove this parameter from your user plist, if you do not use it.']) + else + setNames = [setNames loc_key]; %#ok<AGROW> + setValues = [setValues loc_value]; %#ok<AGROW> + removePlParam = [removePlParam loc_key ]; %#ok<AGROW> + end + end + end + end + pl.removeKeys(removePlParam); + pl.combine(plist('param names', setNames, 'symbolic params', setNames, 'param values', setValues)); + end + pl = combine(varargin{1}, minfo_in.plists, plDefault); + varargout{2} = pl; + elseif isa(varargin{1}, 'char') && isa(varargin{2}, 'plist') + %% description only request + error('description call is deprecated') + else + error([mfilename ' needs one input argument of class plist and one minfo, but instead input argument was : ' class(varargin{1}) ' and ' class(varargin{2})]) + end + else + error([mfilename ' needs two input arguments instead of ' num2str(numel(varargin))]) + end +end +