view m-toolbox/classes/+utils/@models/functionForVersion.m @ 28:01b86b780ba7 database-connection-manager

Remove LTPDARepositoryManager implementation. Java code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% FUNCTIONFORVERSION returns the function handle for a given version string
% 
% CALL: utils.models.functionForVersion(@getModelDescription, @versionTable, version, @getFileVersion)
% 
function fcn = functionForVersion(getModelDescription, versionTable, version, getVersion)
  if isa(versionTable, 'function_handle')
    vt = versionTable();
  else
    vt = versionTable;
  end
  idx = find(strcmp(vt, version));
  if isempty(idx)
    error('requested version does not exist');
  end
  fcn = vt{idx+1};
end