Hi everyone,
I am running Static Optimization with the Matlab API. In my simulations, I have to increase the external force to find the value at which SO fails. Is there a way to automatically get if SO failed or not as an output, without manually reading the command window at each simulation?
Thanks in advance,
Francesca
Static Optimization in Matlab
- francesca bottin
- Posts: 6
- Joined: Tue Mar 26, 2019 1:06 pm
- Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Re: Static Optimization in Matlab
You should also be able to retrieve this information by checking the out.log and err.log files (renamed to opensim.log as of v4.2; see https://simtk-confluence.stanford.edu:8 ... d=48988768). To detect a certain behavior automatically, you could load this file and search for a particular string.
- John Davis
- Posts: 59
- Joined: Mon Aug 26, 2019 7:42 am
Re: Static Optimization in Matlab
I have a small MATLAB script that I've developed for exactly this purpose. I put together a demo repository on GitHub that uses the Rajagopal 2015 data and my log parsing function, you can check it out here.
It uses the new Logger() class so I think it will only work in OpenSim 4.3+. You can set the file name of the log to correspond to whatever file you are processing, then the function outputs a processed .csv with a column indicating which timestamps, if any, static optimization failed. It should be pretty easy to adapt for your purposes!
It uses the new Logger() class so I think it will only work in OpenSim 4.3+. You can set the file name of the log to correspond to whatever file you are processing, then the function outputs a processed .csv with a column indicating which timestamps, if any, static optimization failed. It should be pretty easy to adapt for your purposes!
- francesca bottin
- Posts: 6
- Joined: Tue Mar 26, 2019 1:06 pm
Re: Static Optimization in Matlab
Thanks for the replies.
@John Davis, thank you for sharing the script. I converted my code to 4.3, adapted your script to my case and it worked!
@John Davis, thank you for sharing the script. I converted my code to 4.3, adapted your script to my case and it worked!