Determining the OpenSim version in use from the MATLAB API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Luca Modenese
Posts: 43
Joined: Wed Jan 21, 2009 9:16 am

Determining the OpenSim version in use from the MATLAB API

Post by Luca Modenese » Fri May 07, 2021 3:46 am

Hello,
I am trying to update some of my scripts so that they can run on OpenSim 4.x but I like the idea of keeping backward compatibility with OpenSim 3.3, which I still use sometimes. I was wondering if there is any method available from the MATLAB API that returns the OpenSim version being used. Currently I am reading the $OPENSIM_HOME environment variable, but I was looking for a more robust approach.
Thank you,
Luca

Tags:

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

Re: Determining the OpenSim version in use from the MATLAB API

Post by Ayman Habib » Fri May 07, 2021 12:02 pm

Hi Luca,

While this may help short term, you probably need to upgrade since official OpenSim 4.0 has been out for close to 3 years but anyway, you can use

Code: Select all

opensimCommonJNI.GetVersion()
to get the exact version of the API you're using. I'm sure this has been in all 4.0+ versions but likely it existed in earlier versions as well.

The environment variable OPENSIM_HOME, has been dropped in version 4.0+, is not set by installer since it pollutes the environment and precludes using multiple installations on the same machine and so should not be assumed by new code.

Please let us know if that works for you,
-Ayman

User avatar
Luca Modenese
Posts: 43
Joined: Wed Jan 21, 2009 9:16 am

Re: Determining the OpenSim version in use from the MATLAB API

Post by Luca Modenese » Tue May 11, 2021 4:36 am

Thank you Ayman, that works!
Based on my tests the method did not exists for OpenSim 3.3 but that is not an issue.
Best wishes,
Luca

POST REPLY