add a marker to model +matlab

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

add a marker to model +matlab

Post by z imn » Tue Aug 14, 2018 5:47 am

Hello every one
i have a question about adding a marker to model's markerset
i attached the code that i used for it....once i get the true answer ...but now when i run it againt, matlab is closed automatically .... the problem is related to this line

Code: Select all

osimModel(i).updateMarkerSet(markers);
thank you for your attention

Code: Select all

import org.opensim.modeling.*
i=1;
osimModel(i)=Model('E:\phd_mechanic\API\API_modeling\fix\scaled_model_without_markers.osim');
markers=MarkerSet('E:\phd_mechanic\API\API_modeling\fix\markers.xml');
zohreh=Marker();
zohreh.setName('zohreh');
zohreh.setBodyName('pelvis');
zohreh.setFixed(true);
markers.adoptAndAppend(zohreh);
markers.print('markers.xml')
markers.connectMarkersToModel(osimModel(i));
osimModel(i).updateMarkerSet(markers);
osimModel(i).print(['MODEL_' num2str(i) '.osim']);

Tags:

User avatar
z imn
Posts: 35
Joined: Sun Sep 17, 2017 7:11 am

Re: add a marker to model +matlab

Post by z imn » Tue Aug 14, 2018 8:21 am

hi again
i studied a related post (viewtopicPhpbb.php?f=91&t=7978&p=25791&start=0&view=)
in this post author said : it said that it often occurs when Windows thinks there is an infinite loop situation occurring. If it is expecting an output immediately and it is taking some time to generate an output it could be the cause. Thanks for all the help to this point.

but does anyone know how to solve this problem ?
does opensim+matlab APi is incomplete?
thanks

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

Re: add a marker to model +matlab

Post by Ayman Habib » Tue Aug 14, 2018 9:00 am

Hello,

Can you please indicate which version of OpenSim you're using (3.3 vs 4.0) so we can help you since there are API differences bertween the two versions.

Thank you,
-Ayman

User avatar
z imn
Posts: 35
Joined: Sun Sep 17, 2017 7:11 am

Re: add a marker to model +matlab

Post by z imn » Tue Aug 14, 2018 12:13 pm

thanks for your response
i use opensim 3.3 and matlab 2015a ...
i want to use matlab api for complete run a simulation... do you suggest the version 4 of opensim or 3.3? i also have the same problem when running RRA and othe steps..... matlab is closed automatically sometimes ....
king regards
zohreh

User avatar
z imn
Posts: 35
Joined: Sun Sep 17, 2017 7:11 am

Re: add a marker to model +matlab

Post by z imn » Wed Aug 15, 2018 7:27 am

Dear developers
i could run this code successfully once ...but now when i run it again (without any change) matlab is closed automatically....
i am really confused ...

Code: Select all

osimModel=Model('E:\phd_mechanic\API\API_modeling\fix\scaled_model_without_markers.osim');
markers=MarkerSet('E:\phd_mechanic\API\API_modeling\fix\markers.xml');
LTTT=Marker();
LTTT.setName('LTTT');
LTTT.setFixed(true);
LTTT.print('LTTT.xml');
markers.adoptAndAppend(LTTT);
markers.print('markers.xml');
f=markers;
osimModel.updateMarkerSet(f);
osimModel.print('a.osim');
Last edited by z imn on Wed Aug 15, 2018 1:04 pm, edited 1 time in total.

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

Re: add a marker to model +matlab

Post by Thomas Uchida » Wed Aug 15, 2018 12:39 pm

Does the script run to completion with these errors?

Code: Select all

markers.print(['markers_' num2str '.xml']); %no argument passed to num2str

Code: Select all

osimModel.print('a.osim']); %closing bracket "]" but no opening bracket

User avatar
z imn
Posts: 35
Joined: Sun Sep 17, 2017 7:11 am

Re: add a marker to model +matlab

Post by z imn » Wed Aug 15, 2018 12:57 pm

hello
you are right ...but i write this code for a loop and when i copied it here i delete the loop incorrectly
now i edited the code. really i think my question is like what is asked in this post (viewtopicPhpbb.php?f=91&t=9403&p=0&star ... ab5469729f)

thanks for your attention

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: add a marker to model +matlab

Post by jimmy d » Wed Aug 15, 2018 5:14 pm

I have answered your question on the thread you linked to.

The issue is most likely the adoptAndAppend. There is some further information on why here;
https://github.com/opensim-org/opensim-core/issues/1765

POST REPLY