over wiriting on an opensim model

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
z imn
Posts: 35
Joined: Sun Sep 17, 2017 7:11 am

over wiriting on an opensim model

Post by z imn » Fri Oct 04, 2019 7:33 am

Hello every one
I am going to add some muscles to an openSim model in a matlab loop, i used this command to add this muscles :

osimModel.updForceSet.adoptAndAppend(mus(j));

although for a small loop it works correctly, but sometimes matlab crashed suddenly, i think it is because of over writing on a model file, how can i fix this issue?

thanks
Zohreh

Tags:

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: over wiriting on an opensim model

Post by Dimitar Stanev » Mon Oct 07, 2019 1:29 pm

Maybe it has to do with who owns the memory. When you append or add something to an OpenSim Model, it should be allocated on the heap and the allocated memory is managed (freed) internally by the model. When you define an object in Matlab/Python it is not allocated on the heap. Therefore, when code gets out of scope (e.g., exit a function) the muscle destructor is called. Maybe you can try cloneAndAppend to see if it works.

https://github.com/opensim-org/opensim- ... Set.h#L474

POST REPLY