MATLAB SCRIPTING, SCALE MODEL
Posted: Tue Feb 17, 2015 10:30 am
Hello,
I am trying to write a Matlab script to control the scale tool. I have already succesfully run IK, ID, RRA and SO in this way but I have never tryed to write a code for the scale tool because I needed to check the position of the markers and this was easier to do manually. Now I am working on a different kind of simulations for which I don't have markers and I am scaling the model just using "Manual scale" measures which can be perfectly done using a script. I though that it would have been the same as I have done for the other OpenSim processes but I encountered a problem. I only need to put the measure in Manual Scale but everytime that I try to change the .xml file, Matlab does not change only the numbers but also the tag <Scale> in <item> so that this:
<!--Scale factors to be used for manual scaling.-->
<ScaleSet>
<objects>
<Scale>
<scales> 1.3 1.3 1.3</scales>
<segment>pelvis</segment>
<apply>true</apply>
</Scale>
becomes this:
<ScaleSet>
<objects>
<item>
<scales> 1.3 1.3 1.3</scales>
<segment>pelvis</segment>
<apply>true</apply>
</item>
And OpenSim does not read the measures.
I tryed to fix the xmlwrite code but if I change the tag <item> in <Scale> then I get a double tag <Scale> and again OpenSim doesn't read the measures.
<ScaleSet>
<objects>
<Scale>
<Scale>
<scales> 1.3 1.3 1.3</scales>
<segment>pelvis</segment>
<apply>true</apply>
</Scale>
Has anyone experienced this problem? Any suggestions about how to fix the code?
Thank you for the help!
Alessandra
I am trying to write a Matlab script to control the scale tool. I have already succesfully run IK, ID, RRA and SO in this way but I have never tryed to write a code for the scale tool because I needed to check the position of the markers and this was easier to do manually. Now I am working on a different kind of simulations for which I don't have markers and I am scaling the model just using "Manual scale" measures which can be perfectly done using a script. I though that it would have been the same as I have done for the other OpenSim processes but I encountered a problem. I only need to put the measure in Manual Scale but everytime that I try to change the .xml file, Matlab does not change only the numbers but also the tag <Scale> in <item> so that this:
<!--Scale factors to be used for manual scaling.-->
<ScaleSet>
<objects>
<Scale>
<scales> 1.3 1.3 1.3</scales>
<segment>pelvis</segment>
<apply>true</apply>
</Scale>
becomes this:
<ScaleSet>
<objects>
<item>
<scales> 1.3 1.3 1.3</scales>
<segment>pelvis</segment>
<apply>true</apply>
</item>
And OpenSim does not read the measures.
I tryed to fix the xmlwrite code but if I change the tag <item> in <Scale> then I get a double tag <Scale> and again OpenSim doesn't read the measures.
<ScaleSet>
<objects>
<Scale>
<Scale>
<scales> 1.3 1.3 1.3</scales>
<segment>pelvis</segment>
<apply>true</apply>
</Scale>
Has anyone experienced this problem? Any suggestions about how to fix the code?
Thank you for the help!
Alessandra