view m-toolbox/classes/+utils/@models/built_in_model_template.m @ 36:5eb86f6881ef
database-connection-manager
Remove commented-out code
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
bc767aaa99a8
line source
+ − % 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