Page 1 of 1

Setting Up MATLAB

Posted: Thu Oct 29, 2020 7:27 am
by gent
Hello,

I just recently downloaded the Wu shoulder musculoskeletal model. Now, I have trouble running the MATLAB code, the JR_MEX.m file. I appreciate any help. I obtain the following errors:

... (I am omitting warnings and some additional file which are called durring the error below)
...
from C:\OpenSim 3.3\Scripts\Matlab\Matlab\Wu_shoulder_model\JR3_mex_parent.cpp:4:
C:\OpenSim 3.3\sdk\include\SimTK\include/pthread.h:307:8: error: redefinition of 'struct timespec'
struct timespec {
^~~~~~~~
... (I am omitting warnings and some additional file which are called durring the error below)
...
from C:\OpenSim 3.3\Scripts\Matlab\Matlab\Wu_shoulder_model\JR3_mex_parent.cpp:4:
C:/ProgramData/MATLAB/SupportPackages/R2020a/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/sys/timeb.h:90:8: error: previous definition of 'struct timespec'
struct timespec {
^~~~~~~~

Since the struct timespec is already defined I commented out the additional definition in pthread.h. Then I get an different error that there are many undefined references.
Does someone know whats wrong here? Maybe setting up the MATLAB with opensim? I am using MATLAB2020a and Opensim 3.3.


Thank you for your help.


Kind regards,

Jeremy

Re: Setting Up MATLAB

Posted: Thu Nov 05, 2020 3:11 am
by gent
I figured it out.
while setting up the mex file funnktion "mex -setup" I chose:
Microsoft Visual C++ 2019 (C) instead of other language mex -setup C++ ---> Microsoft Visual C++ 2019

Re: Setting Up MATLAB

Posted: Fri Nov 06, 2020 8:12 am
by hazimahm
Hi Jeremy,

I am also interested in using Wu Shoulder Model. I just would like to know if the Matlab code still works? I am using OpenSim 4.1 and there is compatibility issue (the API command is somewhat outdated). So I would like to know if it definitely works with OpenSim 3.3 (the code runs perfectly ok).

Thanks,
Hazimah

Re: Setting Up MATLAB

Posted: Tue Nov 10, 2020 1:11 am
by gent
Hi Hazimah,

I just ran in a different problem. While loading the model I get a java.lang.UnsatisfiedLinkError.
I'll get back to you once I figured out the problem.


Cheers,
Jeremy

Re: Setting Up MATLAB

Posted: Wed Nov 11, 2020 6:52 am
by gent
Hi Hazimah,

The MATLAB script does work with OpenSim 3.3.
The Problem with the java.lang.UnsatisfiedLinkError could be resolved by running the configureOpenSim.m again

cheers,

Jeremy
hazimahm wrote:
Fri Nov 06, 2020 8:12 am
Hi Jeremy,

I am also interested in using Wu Shoulder Model. I just would like to know if the Matlab code still works? I am using OpenSim 4.1 and there is compatibility issue (the API command is somewhat outdated). So I would like to know if it definitely works with OpenSim 3.3 (the code runs perfectly ok).

Thanks,
Hazimah

Re: Setting Up MATLAB

Posted: Wed Feb 16, 2022 2:58 am
by kristofferson
I have been having some trouble getting this program to work in Matlab. Currently, I am stuck with this error when running Run_shoulder_model_example.m

Unrecognized function or variable 'getBody'.

Error in Run_shoulder_model_example (line 104)
humerus=mk_GH.getBody();

I am running with OpenSim 4.0