comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % A built-in model of class <CLASS> called <NAME>
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: A built-in model of class <CLASS> called <NAME>
5 %
6 % CALL:
7 % mdl = <CLASS>(plist('built-in', '<NAME>'));
8 %
9 % INPUTS:
10 %
11 %
12 % OUTPUTS:
13 % mdl - an object of class <CLASS>
14 %
15 %
16 % INFO:
17 % <a href="matlab:utils.models.displayModelOverview('<CLASS>_model_<NAME>')">Model Information</a>
18 %
19 %
20 % REFERENCES:
21 %
22 %
23 % VERSION: $Id: built_in_model_template.m,v 1.1 2011/04/29 07:05:54 hewitson Exp $
24 %
25 % HISTORY:
26 %
27 %
28 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29
30 % YOU SHOULD NOT NEED TO EDIT THIS MAIN FUNCTION
31 function varargout = <CLASS>_model_<NAME>(varargin)
32
33 varargout = utils.models.mainFnc(varargin(:), ...
34 mfilename, ...
35 @getModelDescription, ...
36 @getModelDocumentation, ...
37 @getVersion, ...
38 @versionTable);
39
40 end
41
42
43 %--------------------------------------------------------------------------
44 % AUTHORS EDIT THIS PART
45 %--------------------------------------------------------------------------
46
47 function desc = getModelDescription
48 desc = 'A built-in model that ...';
49 end
50
51 function doc = getModelDocumentation
52 doc = sprintf([...
53 'Some information about this model. You can write html code here.\n'...
54 ]);
55 end
56
57 % default version is always the first one
58 function vt = versionTable()
59
60 vt = {...
61 'Version 1', @version1, ...
62 };
63
64 end
65
66 % This version is ...
67 %
68 function varargout = version1(varargin)
69
70 if nargin == 1 && ischar(varargin{1})
71 switch varargin{1}
72 case 'plist'
73
74 % The plist for this version of this model
75 pl = plist();
76
77 % parameter 'My Parameter'
78 p = param({'My Parameter', ['A Parameter which configures the model in some way.']}, ...
79 paramValue.EMPTY_DOUBLE);
80 pl.append(p);
81
82 % set output
83 varargout{1} = pl;
84
85 case 'description'
86 varargout{1} = 'This version is ...';
87 case 'info'
88 % Add info calls for any other models that you use to build this
89 % model. For example:
90 % varargout{1} = [ ...
91 % ao_model_SubModel1('info', 'Some Version') ...
92 % ao_model_SubModel2('info', 'Another Version') ...
93 % ];
94 %
95 varargout{1} = [];
96 otherwise
97 error('unknown inputs');
98 end
99 return;
100 end
101
102 % build model
103 pl = varargin{1};
104
105 % Get parameters
106 p = pl.find('My Parameter');
107
108 % Build the model object the way you want
109
110 obj = <CLASS>();
111
112 varargout{1} = obj;
113
114 end
115
116
117 %--------------------------------------------------------------------------
118 % AUTHORS SHOULD NOT NEED TO EDIT BELOW HERE
119 %--------------------------------------------------------------------------
120
121
122 %--------------------------------------------------------------------------
123 % Get Version
124 %--------------------------------------------------------------------------
125 function v = getVersion
126
127 v = '$Id: built_in_model_template.m,v 1.1 2011/04/29 07:05:54 hewitson Exp $';
128
129 end