Mercurial > hg > ltpda
diff m-toolbox/classes/+utils/@models/functionForVersion.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/functionForVersion.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,16 @@ +% 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 \ No newline at end of file