Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
Sheeba Davis
- Posts: 56
- Joined: Sat Mar 23, 2019 5:19 am
Post
by Sheeba Davis » Fri Mar 05, 2021 3:48 am
Hi
I am trying to replicate Gait2354 model's scale setup file (provided in the OpenSim distribution) using matlab. I need some guidance in setting marker pair names.
<MarkerPair name="">
<!--Names of two markers, the distance between which is used to compute a body scale factor.-->
<markers> V.Sacral Top.Head </markers>
</MarkerPair>
I tried with the following commands in matlab to set the marker names:
Code: Select all
>> myMarkerPair=MarkerPair()
myMarkerPair =
>> myArrayStr=ArrayStr()
myArrayStr =
org.opensim.modeling.ArrayStr@6c518474
>> myArrayStr.set(0,'V.Sacral');
>> myArrayStr.set(1,'Top.Head');
>> myMarkerPair.setMarkerName(myArrayStr);
No method 'setMarkerName' with matching signature found for class 'org.opensim.modeling.MarkerPair'.
But i get an error. I doubt whether the argument is in ArrayStr form. Some help is appreciated.
Thanks in advance
Sheeba
Tags:
-
Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Post
by Ayman Habib » Fri Mar 05, 2021 12:34 pm
Hello,
The signature of the method is
Code: Select all
setMarkerName(int i, String aName)
So you should call the method twice, once per MarkerName
In general you should use the methodsview command in Matlab to see the sugnatures of available methods (names, parameter types etc.)
Hope this helps,
-Ayman
-
Sheeba Davis
- Posts: 56
- Joined: Sat Mar 23, 2019 5:19 am
Post
by Sheeba Davis » Sat Mar 06, 2021 1:56 am
Hi Ayman
Thanks for your help. I now understood how it is done.
I have another doubt: If i have to remove a section from the xml file (for ex: Measurement section in a scale setup file), is xml editor (notepad++) the only option or can we do it (remove/replace) it in Matlab?
Thanks Sheeba
-
Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Post
by Thomas Uchida » Sat Mar 06, 2021 5:34 am
I think the easiest way is a text editor, though you could absolutely do it programmatically---by treating the file as a generic XML file or even as plain text.
-
Sheeba Davis
- Posts: 56
- Joined: Sat Mar 23, 2019 5:19 am
Post
by Sheeba Davis » Sun Mar 07, 2021 10:02 pm
Hi Thomas
Thanks for your response. If it can be done in Matlab, can you please tell me what command i need to use to remove/replace a section in an XML file.
Regards
Sheeba
-
Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Post
by Thomas Uchida » Mon Mar 08, 2021 10:05 am
A very simple strategy would be to open the original file (open in "read" mode), create a new file (open in "write" mode), read each line in the original file one-by-one, and write to the new file only the lines you wish to retain. You can use the "strcmp" function to find lines in the file.
-
Sheeba Davis
- Posts: 56
- Joined: Sat Mar 23, 2019 5:19 am
Post
by Sheeba Davis » Mon Mar 08, 2021 9:02 pm
Hi Thomas
Thanks for your response.
The procedure you mentioned is done using Matlab commands and i was curious to know if there was any class (commands in doxygen - OpenSim & Matlab interface) that would do modify (delete/remove/replace) the xml file.
Regards
Sheeba