Page 1 of 1

Using ScaleTool in Matlab

Posted: Mon Jul 06, 2020 8:05 am
by eadooley
Hello,

I am working on running a simulation using the Matlab API. I have created a model and it is initialized. I am then trying to use the ScaleTool command to scale the generic model to a subject specific model.

Code: Select all

scaler = ScaleTool('scaleMeasuermentSet_v11.xml'); %scale set up xml file
scaled = scaler.run();
model.initSystem();
modelPath = fullfile(cd, 'OttobockInMatlab_v05_scaled.osim');
model.print(modelPath);
This does not seem to save the scaled model, though the command line is showing that all of the scale factors have been computed.

How do you output the scaled model using Matlab?

Is there an example that shows how the scaling tool works through the API? Also are there any resources that show how you could set the scale tool parameters from Matlab, as opposed to loading a pre-made xml file (like commands to make the measurement set, set the mass, and direct to the static TRC file)?

Any tips or documentation would be greatly appreciated.

Thanks,
EAD

Re: Using ScaleTool in Matlab

Posted: Mon Jul 06, 2020 11:08 am
by aymanh
Hi Emily,

it's not clear from the code snippet you posted what is the relation between the model variable and the xml file contents. The scale tool performs both Scaling and Marker placement, if you specify <output_model_file> in the intended section/operation of the xml file then the tool will write the scaled model to a file, then you need to load the model from the file as usual to proceed. The scale tool doesn't provide easy way to interface programmatically with the scaled model directly.

Hope this helps,
-Ayman