view m-toolbox/test/template_test_models/ao_model_b.m @ 33:5e7477b94d94
database-connection-manager
Add known repositories list to LTPDAPreferences
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % DESCRIPTION: Builtin model for B
+ − %
+ − % This model builds an AO with a number in it.
+ − %
+ − %
+ − % CALL:
+ − % p = ao(plist('built-in','b'))
+ − %
+ − % INPUTS:
+ − %
+ − %
+ − %
+ − % OUTPUTS:
+ − % - p: an AO object representing a
+ − %
+ − %
+ − % VERSIONS:
+ − % 'alpha' = Reason: this version returns an AO with value 1
+ − % Who: Martin
+ − % When: 06-09-10
+ − % 'beta' = Reason: this version returns an AO with value 2
+ − % Who: Martin
+ − % When: 06-09-10
+ − %
+ − %
+ − % REFERENCES:
+ − %
+ − %
+ − % VERSION: $Id: ao_model_b.m,v 1.3 2010/09/15 10:30:04 hewitson Exp $
+ − %
+ − % HISTORY:
+ − %
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − function varargout = ao_model_b(varargin)
+ −
+ − % Process inputs
+ − [info, pl, constructorInfo, fcn] = utils.models.processModelInputs(varargin(:), mfilename, @getModelDescription, @getModelDocumentation, @getVersion, @versionTable);
+ − if ~isempty(info)
+ − varargout{1} = info;
+ − return;
+ − end
+ −
+ − % Build the object
+ − out = fcn();
+ −
+ − % Set the method version string in the minfo object
+ − if ~isempty(constructorInfo)
+ − % If this is a user-call via a constructor, then we add history
+ − out = addHistoryStep(out, constructorInfo, pl);
+ − end
+ −
+ − if nargout > 0
+ − varargout{1} = out;
+ − varargout{2} = pl;
+ − else
+ − error('!!! Invalid number of output')
+ − end
+ − end
+ −
+ − %--------------------------------------------------------------------------
+ − % AUTHORS EDIT THIS PART
+ − %--------------------------------------------------------------------------
+ −
+ − function desc = getModelDescription
+ − desc = 'A model which builds a single value AO.';
+ − end
+ −
+ − function doc = getModelDocumentation
+ − doc = '';
+ − end
+ −
+ − function vt = versionTable()
+ −
+ − vt = {'alpha', @versionAlpha, ...
+ − 'beta', @versionBeta};
+ −
+ − end
+ −
+ − % This version uses:
+ − % model b, version 'alpha'
+ − % model c, version 'initial'
+ − %
+ − function varargout = versionAlpha(varargin)
+ −
+ − if nargin == 1 && ischar(varargin{1})
+ − switch varargin{1}
+ − case 'plist'
+ − varargout{1} = plist('a', 1, 'b', 2, 'c', 3);
+ − case 'description'
+ − varargout{1} = 'returns an AO with value 1';
+ − case 'info'
+ − varargout{1} = [];
+ − otherwise
+ − error('unknown inputs');
+ − end
+ − return;
+ − end
+ −
+ − % build model
+ − varargout{1} = ao(1);
+ −
+ − end
+ −
+ − % This version uses:
+ − % model b, version 'alpha'
+ − % model c, version 'second'
+ − %
+ − function varargout = versionBeta(varargin)
+ −
+ − if nargin == 1 && ischar(varargin{1})
+ − switch varargin{1}
+ − case 'plist'
+ − varargout{1} = plist('a', 1);
+ − case 'description'
+ − varargout{1} = 'returns an AO with value 2';
+ − case 'info'
+ − varargout{1} = [];
+ − otherwise
+ − error('unknown inputs');
+ − end
+ − return;
+ − end
+ −
+ − % build model
+ − varargout{1} = ao(2);
+ − end
+ −
+ − %--------------------------------------------------------------------------
+ − % AUTHORS SHOULD NOT NEED TO EDIT BELOW HERE
+ − %--------------------------------------------------------------------------
+ −
+ −
+ − %--------------------------------------------------------------------------
+ − % Get Version
+ − %--------------------------------------------------------------------------
+ − function v = getVersion
+ −
+ − v = '$Id: ao_model_b.m,v 1.3 2010/09/15 10:30:04 hewitson Exp $';
+ −
+ − end
+ −