Page 1 of 1

Joint Reaction Force File Matlab

Posted: Fri Feb 14, 2014 3:34 pm
by alessandronavacchia
Hello,

I am using the OpenSim Matlab API to build a for loop and perform IK, ID, Static Optimization and AnalyzeTool-Reaction Forces 100 times. I managed to perform the first 3 steps (IK, ID and SO) but I got stuck with the Reaction Forces Analysis inside the AnalyzeTool because there is no public function that allows me specifying the Force File (storage file from the Static Optimization results). I cannot specify a static Force File for all the simulations because the file changes every time. Doing it manually (adding the path of the file in the .xml setup) is too time-consuming.

On the documentation I saw that there is a method called loadForcesFromFile(string) that probably does what I need, but it is protected.

Therefore I have the following questions:
1) How can I use a protected method?
2) If I cannot use a protected method, how can I solve my problem without changing manually every .xml setup file?

Thank you very much in advance!

Alessandro

Re: Joint Reaction Force File Matlab

Posted: Fri May 30, 2014 3:52 pm
by mbebelveras
Hi Alessandro,

to solve this problem I:

loaded a generic setup file:

Code: Select all

analyzeTool = AnalyzeTool(genericSetupFile);
then I got the property by its index

Code: Select all

 x=analyzeTool.getAnalysisSet().get(0).getPropertyByIndex(5);
and with the PropertyHelper I could change the name of the file

Code: Select all

PropertyHelper.setValueString('new file',x);
Hope it helps,

Bel

Re: Joint Reaction Force File Matlab

Posted: Sat Aug 16, 2014 3:00 pm
by alessandronavacchia
It was very helpful! Thanks a lot.

Alessandro