comparison m-toolbox/classes/+utils/@models/getDefaultPlist.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 % GETDEFAULTPLIST returns a default plist for the model
2 %
3 % CALL: utils.models.functionForVersion(@getModelDescription, @versionTable)
4 % CALL: utils.models.functionForVersion(@getModelDescription, @versionTable, version, @getFileVersion)
5 %
6 function pl = getDefaultPlist(varargin)
7
8 getModelDescription = varargin{1};
9 versionTable = varargin{2};
10 options = {};
11 if nargin > 2
12 if ischar(varargin{3})
13 options = varargin(3);
14 else
15 options = varargin{3};
16 end
17 end
18
19 % default plist for all model versions
20 vt = versionTable();
21 idx = 1; % we take the first version as default
22 versions = vt(1:2:end);
23 if numel(options)>=1 && ischar(options{1})
24 idx = find(strcmp(options{1}, versions));
25 if ~utils.helper.ismember(options{1}, versions)
26 error('requested version does not exist');
27 end
28 end
29 version = versions{idx};
30 pl = plist({'VERSION', 'Model version'}, {idx, vt(1:2:end), paramValue.SINGLE});
31
32
33 % add plist for this version
34 fcn = utils.models.functionForVersion(getModelDescription, versionTable, version);
35 pl.combine(fcn('plist'));
36 pl.setName(sprintf('Parameter List for version: %s', version));
37 end