Mercurial > hg > ltpda
diff m-toolbox/classes/+utils/@models/built_in_model_template.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children | bc767aaa99a8 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/+utils/@models/built_in_model_template.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,129 @@ +% A built-in model of class <CLASS> called <NAME> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: A built-in model of class <CLASS> called <NAME> +% +% CALL: +% mdl = <CLASS>(plist('built-in', '<NAME>')); +% +% INPUTS: +% +% +% OUTPUTS: +% mdl - an object of class <CLASS> +% +% +% INFO: +% <a href="matlab:utils.models.displayModelOverview('<CLASS>_model_<NAME>')">Model Information</a> +% +% +% REFERENCES: +% +% +% VERSION: $Id: built_in_model_template.m,v 1.1 2011/04/29 07:05:54 hewitson Exp $ +% +% HISTORY: +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% YOU SHOULD NOT NEED TO EDIT THIS MAIN FUNCTION +function varargout = <CLASS>_model_<NAME>(varargin) + + varargout = utils.models.mainFnc(varargin(:), ... + mfilename, ... + @getModelDescription, ... + @getModelDocumentation, ... + @getVersion, ... + @versionTable); + +end + + +%-------------------------------------------------------------------------- +% AUTHORS EDIT THIS PART +%-------------------------------------------------------------------------- + +function desc = getModelDescription + desc = 'A built-in model that ...'; +end + +function doc = getModelDocumentation + doc = sprintf([... + 'Some information about this model. You can write html code here.\n'... + ]); +end + +% default version is always the first one +function vt = versionTable() + + vt = {... + 'Version 1', @version1, ... + }; + +end + +% This version is ... +% +function varargout = version1(varargin) + + if nargin == 1 && ischar(varargin{1}) + switch varargin{1} + case 'plist' + + % The plist for this version of this model + pl = plist(); + + % parameter 'My Parameter' + p = param({'My Parameter', ['A Parameter which configures the model in some way.']}, ... + paramValue.EMPTY_DOUBLE); + pl.append(p); + + % set output + varargout{1} = pl; + + case 'description' + varargout{1} = 'This version is ...'; + case 'info' + % Add info calls for any other models that you use to build this + % model. For example: + % varargout{1} = [ ... + % ao_model_SubModel1('info', 'Some Version') ... + % ao_model_SubModel2('info', 'Another Version') ... + % ]; + % + varargout{1} = []; + otherwise + error('unknown inputs'); + end + return; + end + + % build model + pl = varargin{1}; + + % Get parameters + p = pl.find('My Parameter'); + + % Build the model object the way you want + + obj = <CLASS>(); + + varargout{1} = obj; + +end + + +%-------------------------------------------------------------------------- +% AUTHORS SHOULD NOT NEED TO EDIT BELOW HERE +%-------------------------------------------------------------------------- + + +%-------------------------------------------------------------------------- +% Get Version +%-------------------------------------------------------------------------- +function v = getVersion + + v = '$Id: built_in_model_template.m,v 1.1 2011/04/29 07:05:54 hewitson Exp $'; + +end