Scaling with Matlab API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Arthur Favennec
Posts: 4
Joined: Thu Nov 28, 2019 6:13 am

Scaling with Matlab API

Post by Arthur Favennec » Mon Jan 24, 2022 1:17 am

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

Tags:

User avatar
Carmichael Ong
Posts: 375
Joined: Fri Feb 24, 2012 11:50 am

Re: Scaling with Matlab API

Post by Carmichael Ong » Mon Jan 24, 2022 11:19 am

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.

User avatar
Arthur Favennec
Posts: 4
Joined: Thu Nov 28, 2019 6:13 am

Re: Scaling with Matlab API

Post by Arthur Favennec » Wed Mar 16, 2022 2:32 am

Thank you for your help !

Arthur

User avatar
Jacob J. Banks
Posts: 88
Joined: Tue Jul 15, 2014 5:17 am

Re: Scaling with Matlab API

Post by Jacob J. Banks » Wed Mar 16, 2022 6:14 am

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
Attachments
ScaleOpenSim.zip
(1.36 KiB) Downloaded 79 times

User avatar
Arthur Favennec
Posts: 4
Joined: Thu Nov 28, 2019 6:13 am

Re: Scaling with Matlab API

Post by Arthur Favennec » Mon Jun 13, 2022 12:35 am

Thank you for this example file. It helped me a lot !

Arthur Favennec

POST REPLY