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