Mercurial > hg > ltpda
comparison m-toolbox/test/template_test_models/ao_model_c.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
2 % | |
3 % DESCRIPTION: Builtin model for C | |
4 % | |
5 % This model builds an AO with a vector in it. | |
6 % | |
7 % | |
8 % CALL: | |
9 % p = ao(plist('built-in','c')) | |
10 % | |
11 % INPUTS: | |
12 % | |
13 % | |
14 % | |
15 % OUTPUTS: | |
16 % - p: an AO object representing a | |
17 % | |
18 % | |
19 % VERSIONS: | |
20 % 'initial' = Reason: this version returns an AO with values 3,4,5 | |
21 % Who: Martin | |
22 % When: 06-09-10 | |
23 % 'second' = Reason: this version returns an AO with values 6,7,8 | |
24 % Who: Martin | |
25 % When: 06-09-10 | |
26 % | |
27 % | |
28 % REFERENCES: | |
29 % | |
30 % | |
31 % VERSION: $Id: ao_model_c.m,v 1.3 2010/09/15 10:30:04 hewitson Exp $ | |
32 % | |
33 % HISTORY: | |
34 % | |
35 % | |
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
37 function varargout = ao_model_c(varargin) | |
38 | |
39 % Process inputs | |
40 [info, pl, constructorInfo, fcn] = utils.models.processModelInputs(varargin(:), mfilename, @getModelDescription, @getModelDocumentation, @getVersion, @versionTable); | |
41 if ~isempty(info) | |
42 varargout{1} = info; | |
43 return; | |
44 end | |
45 | |
46 % Build the object | |
47 out = fcn(); | |
48 | |
49 % Set the method version string in the minfo object | |
50 if ~isempty(constructorInfo) | |
51 % If this is a user-call via a constructor, then we add history | |
52 out = addHistoryStep(out, constructorInfo, pl); | |
53 end | |
54 | |
55 if nargout > 0 | |
56 varargout{1} = out; | |
57 varargout{2} = pl; | |
58 else | |
59 error('!!! Invalid number of output') | |
60 end | |
61 end | |
62 | |
63 %-------------------------------------------------------------------------- | |
64 % AUTHORS EDIT THIS PART | |
65 %-------------------------------------------------------------------------- | |
66 | |
67 % This is the main description for the model. Additional descriptions of | |
68 % each version should be added in the version function. | |
69 function desc = getModelDescription | |
70 desc = 'A model which builds a 3 element vector AO.'; | |
71 end | |
72 | |
73 function doc = getModelDocumentation | |
74 doc = ''; | |
75 end | |
76 | |
77 % A lookup table which defines which function to call for a given version | |
78 % name. | |
79 function vt = versionTable() | |
80 | |
81 vt = {'initial', @initialVersion, ... | |
82 'second', @secondVersion}; | |
83 | |
84 end | |
85 | |
86 % This version uses: | |
87 % model b, version 'alpha' | |
88 % model c, version 'initial' | |
89 % | |
90 function varargout = initialVersion(varargin) | |
91 | |
92 if nargin == 1 && ischar(varargin{1}) | |
93 switch varargin{1} | |
94 case 'plist' | |
95 varargout{1} = plist(); | |
96 case 'description' | |
97 varargout{1} = 'returns an AO with values 3,4,5'; | |
98 case 'info' | |
99 varargout{1} = []; | |
100 otherwise | |
101 error('unknown inputs'); | |
102 end | |
103 return; | |
104 end | |
105 | |
106 % build model | |
107 varargout{1} = ao([3 4 5]); | |
108 | |
109 end | |
110 | |
111 % This version uses: | |
112 % model b, version 'alpha' | |
113 % model c, version 'second' | |
114 % | |
115 function varargout = secondVersion(varargin) | |
116 | |
117 if nargin == 1 && ischar(varargin{1}) | |
118 switch varargin{1} | |
119 case 'plist' | |
120 varargout{1} = plist('a', 1); | |
121 case 'description' | |
122 varargout{1} = 'returns an AO with values 6,7,8'; | |
123 case 'info' | |
124 varargout{1} = []; | |
125 otherwise | |
126 error('unknown inputs'); | |
127 end | |
128 return; | |
129 end | |
130 | |
131 % build model | |
132 varargout{1} = ao([6 7 8]); | |
133 end | |
134 | |
135 %-------------------------------------------------------------------------- | |
136 % AUTHORS SHOULD NOT NEED TO EDIT BELOW HERE | |
137 %-------------------------------------------------------------------------- | |
138 | |
139 | |
140 %-------------------------------------------------------------------------- | |
141 % Get Version | |
142 %-------------------------------------------------------------------------- | |
143 function v = getVersion | |
144 | |
145 v = '$Id: ao_model_c.m,v 1.3 2010/09/15 10:30:04 hewitson Exp $'; | |
146 | |
147 end | |
148 | |
149 | |
150 |