Scripting with Matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Dom Willmore
Posts: 4
Joined: Tue Nov 02, 2021 4:06 am

Scripting with Matlab

Post by Dom Willmore » Fri Feb 18, 2022 6:38 am

Hi there,

I've been trying to follow the 'Scripting with Matlab' instructions (see #1 below) but am running into a problem which does not allow me to progress any further (see #2 below). I have followed the steps but am still facing this error. Any suggstions would be great. Thank you

#1

Setting up your Matlab Scripting Environment
These instructions assume that you've already installed OpenSim version 4.0 or later (see Installation Guide for more info). As noted above, OpenSim 4.0 requires 64-bit Matlab.

1. Launch MATLAB. If you're using Windows and you have OpenSim 3.x configured with Matlab, make sure to "Run as administrator" (available by right-clicking the MATLAB application in the start menu, etc.).
2. Change your Current Folder to the OpenSim Matlab Scripts directory. On Windows, by default, this is C:/Users/<username>/Documents/OpenSim/4.0/Code/Matlab.
3. Run the configureOpenSim.m file from the current folder. The script will prompt you to choose your OpenSim installation directory (we will refer to this as OPENSIM_INSTALL_DIR). On Windows, by default, this is C:/OpenSim 4.0.
4. When the script finishes, you should see a dialog box notifying you if the script succeeded. If the script did not succeed, read the output in the command window for more information.
5. Windows users: ensure that the OPENSIM_INSTALL_DIR/bin directory (e.g., C:/OpenSim 4.0/bin) appears in your system PATH environment variable, and that it appears before any other OpenSim installations you may have on your PATH. The steps to set your path are shown in the animated image below. Double click the image to zoom in. Or see here for additional help on setting your PATH environment variable.
6.Restart MATLAB; the OpenSim libraries will not be recognized until doing so.
7. Test that everything is configured correctly: In the command window, run the following: org.opensim.modeling.opensimCommon.GetVersion() % This should print the version of OpenSim that you've configured with MATLAB



#2

>> org.opensim.modeling.opensimCommon.GetVersion()
Failed to load one or more dynamic libraries for OpenSim.
java.lang.UnsatisfiedLinkError: C:\OpenSim 4.3\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.swig_module_init()V

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

at org.opensim.modeling.opensimCommonJNI.<clinit>(opensimCommonJNI.java:3149)

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


>> org.opensim.modeling.opensimCommon.GetVersion()
Java exception occurred:
java.lang.NoClassDefFoundError: Could not initialize class org.opensim.modeling.opensimCommonJNI

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

Tags:

POST REPLY