view m-toolbox/classes/+utils/@models/getDefaultPlist.m @ 33:5e7477b94d94 database-connection-manager

Add known repositories list to LTPDAPreferences
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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