scripting with matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
vahid F
Posts: 19
Joined: Mon Jul 23, 2018 8:02 am

scripting with matlab

Post by vahid F » Thu Jul 26, 2018 12:11 pm

Dear All,
I tried to interface opensim with matlab. I followed the procedure given in the documentation page( https://simtk-confluence.stanford.edu:8 ... ith+Matlab ) and running the configureOpenSim script.While running code for test that OpenSim is properly configured with MATLAB( org.opensim.modeling.opensimCommon.GetVersion() ) It failed to load the java library. My opensim install directory\ bin is in the system path. I received error mentioned below:
>> org.opensim.modeling.opensimCommon.GetVersion()
Failed to load one or more dynamic libraries for OpenSim.
java.lang.UnsatisfiedLinkError: C:\opensim 4.0\bin\osimJavaJNI.dll: Can't find dependent libraries
Make sure OpenSim's bin directory is on your PATH.
See https://simtk-confluence.stanford.edu/d ... ith+Matlab
Java exception occurred:
java.lang.UnsatisfiedLinkError: org.opensim.modeling.opensimCommonJNI.GetVersion()Ljava/lang/String;

at org.opensim.modeling.opensimCommonJNI.GetVersion(Native Method)

at org.opensim.modeling.opensimCommon.GetVersion(opensimCommon.java:25)

My opensim 4.0 is 64bit and my matlab is MATLAB R2016a 64bit. I don't have multiple versions in the system path .
Please give your suggestions to resolve this issue.
Tancks.
Vahid.

Tags:

User avatar
Thomas Uchida
Posts: 1794
Joined: Wed May 16, 2012 11:40 am

Re: scripting with matlab

Post by Thomas Uchida » Sun Aug 05, 2018 9:18 pm

Were you able to resolve the issue? This exception is typically thrown when the bin directory is not in the Windows PATH. Another possibility is that you have built from source but didn't build the bindings. You could try following the instructions under "Having trouble? Try manual setup..." on the "Scripting with Matlab" page (https://simtk-confluence.stanford.edu/d ... ith+Matlab).

User avatar
Andrew Meyer
Posts: 4
Joined: Fri Sep 03, 2010 8:44 am

Re: scripting with matlab

Post by Andrew Meyer » Tue Sep 25, 2018 1:14 pm

I am having the exact same issue as Vahid. I've been using OpenSim 3.3, but want to switch to the 4.0 beta.

Things I have tried to resolve the issue:
Manually configured matlab according the the instructions found here (https://simtk-confluence.stanford.edu/d ... ith+Matlab)
Manually removed all references to previous OpenSim install in matlab path and in system environment variables.
Added the new opensim install to the system environment variables.
Removed the period and space from the opensim path.
Rebooted my computer.
Manually configured using the matlab pre-2012a instructions.

Do you have any more suggestions for me? My next step would be to reinstall both opensim and matlab.

This is the output I get in matlab:

>> org.opensim.modeling.opensimCommon.GetVersion()
Failed to load one or more dynamic libraries for OpenSim.
java.lang.UnsatisfiedLinkError: C:\OpenSim4-2018-08-27-ae111a49\bin\osimJavaJNI.dll: Can't find dependent libraries
Make sure OpenSim's bin directory is on your PATH.
See https://simtk-confluence.stanford.edu/d ... ith+Matlab
Warning: A Java exception occurred trying to load the org/opensim/modeling/opensimCommonConstants class:
Java exception occurred:
java.lang.UnsatisfiedLinkError: org.opensim.modeling.opensimCommonJNI.GET_SYSTEM_INFO_get()Ljava/lang/String;

at org.opensim.modeling.opensimCommonJNI.GET_SYSTEM_INFO_get(Native Method)

at org.opensim.modeling.opensimCommonConstants.<clinit>(opensimCommonConstants.java:12)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at com.mathworks.jmi.OpaqueJavaInterface.findClass(OpaqueJavaInterface.java:137)

Java exception occurred:
java.lang.UnsatisfiedLinkError: org.opensim.modeling.opensimCommonJNI.GetVersion()Ljava/lang/String;

at org.opensim.modeling.opensimCommonJNI.GetVersion(Native Method)

at org.opensim.modeling.opensimCommon.GetVersion(opensimCommon.java:25)

User avatar
Andrew Meyer
Posts: 4
Joined: Fri Sep 03, 2010 8:44 am

Re: scripting with matlab

Post by Andrew Meyer » Tue Sep 25, 2018 2:04 pm

Edit: I figured it out. I was adding a new environment variable to the system, rather than modifying the path variable and adding in the Opensim directory. Hope this helps if others have a similar issue.

User avatar
Tamesh Halder
Posts: 3
Joined: Thu May 02, 2019 10:18 pm

Re: scripting with matlab

Post by Tamesh Halder » Tue May 14, 2019 3:13 am

Hi Andrew,
How you resolved this issue??

User avatar
Andy Chan
Posts: 2
Joined: Sun Aug 12, 2018 8:34 pm

Re: scripting with matlab

Post by Andy Chan » Thu Oct 03, 2019 8:32 pm

Hi, I have just work out the same problems,the origination of this bug in my PC(x64, Win10,matlab2018b) is that I have 2 edition of opensim, so make sure there is only one dirctory in our variable Path. And I hope that will help!

POST REPLY