Page 1 of 1

Scaling with Matlab API

Posted: Mon Jan 24, 2022 1:17 am
by arthurfavennec
Hello !

I am trying to scale a model using the API on Matlab but my code doesn't work. I think I don't fully understand how the ScaleTool function is working. I didn't found any resources about how to scale a model with the API on the forum or in code examples.

I am triyng to scale the LFB-model.osim with a setup file Setup-scale_AF.xml.

Here is my code :

import org.opensim.modeling.*;

model = Model('.\LFB_model.osim');
model.initSystem();
ScTool = ScaleTool('.\Setup-scale_AF.xml');

ScTool.createModel(model); %don't work
ScTool.setModel(model); %don't work neither

ScTool.run();

Thank you in advance for any input or help you can provide !

Arthur Favennec

Re: Scaling with Matlab API

Posted: Mon Jan 24, 2022 11:19 am
by ongcf
Looking at the Doxygen page, it looks like the `setPathToSubject` function could be helpful here. Note that it takes a string as input, so make sure to use the file path rather than a Model object.

Re: Scaling with Matlab API

Posted: Wed Mar 16, 2022 2:32 am
by arthurfavennec
Thank you for your help !

Arthur

Re: Scaling with Matlab API

Posted: Wed Mar 16, 2022 6:14 am
by jbanks
In case Carmichael's post didn't completely do the trick/your still having issues, here is a Matlab API we use/wrote to scale things. I think it is fairly self-explanatory. It requires you have a setup file already saved with some of your basic parameters.
Jake Banks

Re: Scaling with Matlab API

Posted: Mon Jun 13, 2022 12:35 am
by arthurfavennec
Thank you for this example file. It helped me a lot !

Arthur Favennec