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