Problem with Matlab API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
nadia Khlail
Posts: 1
Joined: Thu Nov 17, 2022 1:54 pm

Problem with Matlab API

Post by nadia Khlail » Sun Apr 23, 2023 4:55 pm

i'm trying to connect opensim and Matlab, during scripting of Matlab i receive an error in this field '' Using a model's "Lists" through iterators''
for example, i write this code:

>> model = Model("Tug_of_War.osim")
bodyList = model.getBodyList(); % Get the Model's BodyList
iter = bodyList.begin(); % Start the iterator at the beginning of the list
while ~iter.equals(bodyList.end()) % Stay in the loop until the iterator reaches the end of the list
iter.getName() % Print name to console
iter.next() % Move the iterator to the next body in the list
end

and receive this error for any model i use

Java exception occurred:
java.io.IOException: Object: Cannot open file Tug_of_War.osim. It may not exist or you do not
have permission to read it.
Thrown at Object.cpp:105 in Object().

at org.opensim.modeling.opensimSimulationJNI.new_Model__SWIG_1(Native Method)

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

is there any solution?
i use 64 operating system and 64 Matlab

Tags:

User avatar
Mohammadreza Rezaie
Posts: 408
Joined: Fri Nov 24, 2017 12:48 am

Re: Problem with Matlab API

Post by Mohammadreza Rezaie » Mon Apr 24, 2023 8:27 am

Hi,
Cannot open file Tug_of_War.osim. It may not exist or you do not have permission to read it.
Please double-check your model file exists in your MATLAB working directory. You can also write the full path of the model.

POST REPLY