Changing manual scaling factors using MATLAB API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Yusuke Okita
Posts: 44
Joined: Sun Nov 21, 2010 11:25 pm

Changing manual scaling factors using MATLAB API

Post by Yusuke Okita » Wed Dec 05, 2018 11:18 pm

Hello,

I would be grateful if someone could tell me how to change manual scale factors using MATLAB and OpenSim 4.0.
I would like to systematically change manual scaling factors defined in a ScaleTool object (below is the corresponding part in an .xml file) to generate models with different knee heights with the same leg length.
<ModelScaler>
<Scaleset>
<Scale>
<scales> 1 1 1</scales>
<segment>femur</segment>
<apply>true</apply>
</Scale>
...
I could get access to the property, but cannot find the way to change the list values in the AbstractProperty class.
I think there would be a more sophisticated way to get access and update the values. I would appreciate any advice.

Code: Select all

a = ScaleTool(filepath)
b = a.getModelScaler();
c = b.getScaleSet();
d = c.getPropertyByIndex(0); % 0:  <segment>femur
e = getValueAsObject(0); % 0: <scales> 
manualScaleFactorsForFemur = get PropertyByIndex(0);
Kind regards,
Yusuke Okita

Tags:

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

Re: Changing manual scaling factors using MATLAB API

Post by jimmy d » Thu Dec 06, 2018 11:56 am

You will have to safedowncast to the concrete class

Code: Select all

scaleObject = Scale.safeDownCast(e)
scaleObject.setScaleFactors( Vec3(1,1,1) )

User avatar
Yusuke Okita
Posts: 44
Joined: Sun Nov 21, 2010 11:25 pm

Re: Changing manual scaling factors using MATLAB API

Post by Yusuke Okita » Thu Dec 06, 2018 9:05 pm

I could successfully change scaling factors according to your advice. Thank you!

POST REPLY