view m-toolbox/classes/@ssm/setParams.m @ 26:ce4df2e95a55
database-connection-manager
Remove LTPDARepositoryManager initialization
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − % SETPARAMS Sets the parameters of the model to the given plist.
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % DESCRIPTION: SETPARAMS Sets the params of the model to the given plist.
+ − %
+ − % CALL: obj = obj.setParameters(pl);
+ − %
+ − % <a href="matlab:utils.helper.displayMethodInfo('ssm', 'setParams')">Parameters Description</a>
+ − %
+ − % VERSION: $Id: setParams.m,v 1.10 2011/04/08 08:56:23 hewitson Exp $
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ −
+ − function varargout = setParams(varargin)
+ −
+ − %% Check if this is a call for parameters
+ − if utils.helper.isinfocall(varargin{:})
+ − varargout{1} = getInfo(varargin{3});
+ − return
+ − end
+ −
+ − import utils.const.*
+ − utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
+ −
+ − %% Collect input variable names
+ − in_names = cell(size(varargin));
+ − for ii = 1:nargin,in_names{ii} = inputname(ii);end
+ −
+ − [ssms, ssm_invars, rest] = utils.helper.collect_objects(varargin(:), 'ssm', in_names);
+ − [pl, invars2, rest] = utils.helper.collect_objects(rest(:), 'plist');
+ − if ~isempty(rest)
+ − pl = combine(pl, plist(rest{:}));
+ − end
+ − pl = combine(pl, getDefaultPlist());
+ −
+ − %%% Internal call: Only one object + don't look for a plist
+ − internal = strcmp(varargin{end}, 'internal');
+ −
+ − if numel(pl)>1 || isempty(pl)
+ − error('### Please give one input plist');
+ − end
+ −
+ − outs = copy(ssms, nargout);
+ −
+ − %% Loop over the input ssm objects
+ − for kk = 1:numel(outs)
+ − ss = outs(kk);
+ − ss.params = params;
+ − if ~internal
+ − % append history step
+ − ss.addHistory(getInfo('None'), pl, ssm_invars(kk), ss.hist);
+ − end
+ − end % End loop over ssm objects
+ −
+ −
+ − %% Set output
+ − if nargout == numel(outs)
+ − % List of outputs
+ − for ii = 1:numel(outs)
+ − varargout{ii} = outs(ii);
+ − end
+ − else
+ − % Single output
+ − varargout{1} = outs;
+ − end
+ − end
+ −
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − % Local Functions %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ −
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % FUNCTION: getInfo
+ − %
+ − % DESCRIPTION: Get Info Object
+ − %
+ − % HISTORY: 11-07-07 M Hewitson
+ − % Creation.
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ −
+ − function ii = getInfo(varargin)
+ − if nargin == 1 && strcmpi(varargin{1}, 'None')
+ − sets = {};
+ − pl = [];
+ − else
+ − sets = {'Default'};
+ − pl = getDefaultPlist;
+ − end
+ − % Build info object
+ − ii = minfo(mfilename, 'ssm', 'ltpda', utils.const.categories.helper, '$Id: setParams.m,v 1.10 2011/04/08 08:56:23 hewitson Exp $', sets, pl);
+ − end
+ −
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % FUNCTION: getDefaultPlist
+ − %
+ − % DESCRIPTION: Get Default Plist
+ − %
+ − % HISTORY: 11-07-07 M Hewitson
+ − % Creation.
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ −
+ − function plo = getDefaultPlist()
+ − plo = plist();
+ −
+ − % params
+ − p = param({'params', 'A plist containing the list of parameters.'}, {1, {plist}, paramValue.OPTIONAL});
+ − plo.append(p);
+ − end
+ −
+ −
+ −