Page 1 of 1

3.3 MATLAB API Scripting

Posted: Mon Sep 14, 2015 8:50 pm
by nathanbrantly
Hi OpenSim Team,

I am having problems configuring the MATLAB API Scripting Environment for version 3.3 of OpenSim. I have used MATLAB for scripting successfully in version 3.2. However, I was hoping to upgrade to version 3.3 to have access to the new features.

I am running Windows 7 with 64-bit MATLAB and OpenSim (both 3.2 and 3.3). I ran the automated MATLAB configuration successfully. As a check, I have even gone through all of the steps in the manual setup to ensure that all of the files were updated appropriately. I am even able to import the libraries with the import org.opensim.modeling.*; command without error. However, I get a java error when I follow up that line with myModel = Model(); or just use myModel = org.opensim.modeling.Model(); directly. The GUI for both 3.2 and 3.3 has worked fine for me so far, although I have not used the 3.3 GUI for much more than visualizing and running tutorial 3. Additionally, I uninstalled my 32-bit version of Java and installed the most recent 64-bit version. Following that step, I tried updating the .conf file jdkhome variable based on something I saw from a previous forum post. As 3.3 has been unsuccessful, I reran the 3.2 MATLAB setup file. The 3.2 API still works fine. The errors that I see are below. Thank you for your help.

"Required library failed to load. Check that the dynamic library osimJavaJNI is in your PATH
java.lang.UnsatisfiedLinkError: C:\OpenSim 3.0\bin\osimJavaJNI.dll: The specified procedure could not be found."

When that error message window is closed, the following is displayed in the MATLAB command window.

Java exception occurred:
java.lang.UnsatisfiedLinkError:

org.opensim.modeling.opensimModelJNI.swig_module_init()V

at org.opensim.modeling.opensimModelJNI.swig_module_init(Native
Method)

at
org.opensim.modeling.opensimModelJNI.<clinit>(opensimModelJNI.java:8014)

at org.opensim.modeling.Model.<init>(Model.java:118)

Nathan Brantly

Re: 3.3 MATLAB API Scripting

Posted: Tue Sep 15, 2015 10:15 am
by jimmy
Hi Nathan,

have you changed the operating systems path variables to point to OpenSim 3.3?

I had the same issue and I resolved it by taking 3.2 off my system path, leaving only 3.3.

Cheers,
-James

Re: 3.3 MATLAB API Scripting

Posted: Tue Sep 15, 2015 7:11 pm
by nathanbrantly
Thank you, James!

I had both 3.2 and 3.3 in the system path variable. I mainly had both because the website makes it sound like it is possible to keep old versions of OpenSim installed for use, and I was hoping to keep it around for a backup option.

Thanks,
Nathan

Re: 3.3 MATLAB API Scripting

Posted: Wed Sep 16, 2015 7:56 am
by jimmy
You can still have old versions around! I have every version of OpenSim on my computer for trouble shooting. You just can't have them all on your path otherwise things get messed up. When you want to open an older version you can just navigate to the versions bin folder and launch from the .exe

Cheers
-j

Re: 3.3 MATLAB API Scripting

Posted: Wed Sep 16, 2015 4:55 pm
by backdrifts
Hi Nathan,

I also have multiple installations of OpenSim, and I have faced your same problem in the past. I wanted to be able to launch any OpenSim version without incurring in PATH problem.

Currently, my solution is to use custom .bat files that automatically updated the environment PATH for a specific version of OpenSim.

For example, to launch OpenSim 3.2 I use the following script (copy-past ina a text file and rename as .bat):

Code: Select all

set "OPENSIM_HOME=C:\OpenSim3.2"
set "PATH=%OPENSIM_HOME%\bin;%PATH%"
C:\OpenSim3.2\bin\opensim.exe


So, you can have a bat file for each OpenSim version you want to run.

You can do the same for Matlab

Code: Select all

set "OPENSIM_HOME=C:\OpenSim3.2"
set "PATH=%OPENSIM_HOME%\bin;%PATH%"
matlab.exe
Claudio