[76e9f4]: / tool_funcs / getOpenSimVersion.m

Download this file

36 lines (28 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%-------------------------------------------------------------------------%
% Copyright (c) 2021 Modenese L. %
% Author: Luca Modenese, 2021 %
% email: l.modenese@imperial.ac.uk %
% ----------------------------------------------------------------------- %
% This script returns the OpenSim version
% ----------------------------------------------------------------------- %
function [osim_version_float, osim_version_string] = getOpenSimVersion()
import org.opensim.modeling.*
% read env variable
try
% method available only from 4.x
os_version = char(opensimCommonJNI.GetVersion());
% get the field separators, e.g. '-
% sep_set = strfind(os_version, '-');
% use the last file separator to get the OpenSim installation folder name
version = os_version(1:3);
% get the string for the opensim version
osim_version_string = strtrim(strrep(lower(version),'opensim', ''));
% transform in float
osim_version_float = str2double(osim_version_string);
catch
% GetVersion is not available in earlier OpenSim versions
osim_version_float = 3.3;
osim_version_string = '3.3';
return
end
end