Page 1 of 1

add a marker to model +matlab

Posted: Tue Aug 14, 2018 5:47 am
by zohreh
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']);

Re: add a marker to model +matlab

Posted: Tue Aug 14, 2018 8:21 am
by zohreh
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

Re: add a marker to model +matlab

Posted: Tue Aug 14, 2018 9:00 am
by aymanh
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

Re: add a marker to model +matlab

Posted: Tue Aug 14, 2018 12:13 pm
by zohreh
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

Re: add a marker to model +matlab

Posted: Wed Aug 15, 2018 7:27 am
by zohreh
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');

Re: add a marker to model +matlab

Posted: Wed Aug 15, 2018 12:39 pm
by tkuchida
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

Re: add a marker to model +matlab

Posted: Wed Aug 15, 2018 12:57 pm
by zohreh
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

Re: add a marker to model +matlab

Posted: Wed Aug 15, 2018 5:14 pm
by jimmy
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