Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/+utils/@models/getDefaultPlist.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,37 @@ +% GETDEFAULTPLIST returns a default plist for the model +% +% CALL: utils.models.functionForVersion(@getModelDescription, @versionTable) +% CALL: utils.models.functionForVersion(@getModelDescription, @versionTable, version, @getFileVersion) +% +function pl = getDefaultPlist(varargin) + + getModelDescription = varargin{1}; + versionTable = varargin{2}; + options = {}; + if nargin > 2 + if ischar(varargin{3}) + options = varargin(3); + else + options = varargin{3}; + end + end + + % default plist for all model versions + vt = versionTable(); + idx = 1; % we take the first version as default + versions = vt(1:2:end); + if numel(options)>=1 && ischar(options{1}) + idx = find(strcmp(options{1}, versions)); + if ~utils.helper.ismember(options{1}, versions) + error('requested version does not exist'); + end + end + version = versions{idx}; + pl = plist({'VERSION', 'Model version'}, {idx, vt(1:2:end), paramValue.SINGLE}); + + + % add plist for this version + fcn = utils.models.functionForVersion(getModelDescription, versionTable, version); + pl.combine(fcn('plist')); + pl.setName(sprintf('Parameter List for version: %s', version)); +end