0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % FUNCTIONFORVERSION returns the function handle for a given version string
|
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, version, @getFileVersion)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 function fcn = functionForVersion(getModelDescription, versionTable, version, getVersion)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 if isa(versionTable, 'function_handle')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 vt = versionTable();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 vt = versionTable;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 idx = find(strcmp(vt, version));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 if isempty(idx)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 error('requested version does not exist');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 fcn = vt{idx+1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 end |