Page 1 of 1

Gait % and MATLAB

Posted: Mon Jun 21, 2021 1:12 pm
by avivaldi94
Hello!

I need to plot results (joint angles for example) over the gait cycle % as X label. I understand that I have to export to MATLAB and create a code there but I am not sure how to export to MATLAB since Open Sim only lets me export to .mot or .sto. Also, is there a specific code I need to use in MATLAB? I'm not to sure what code to even use to do the % Gait.

Thanks!

Re: Gait % and MATLAB

Posted: Tue Jun 22, 2021 12:01 pm
by aymanh
Hello,

As of now OpenSim does not provide support for segmenting a trajectory to gait cycles, the tools including the plotter use "time" instead, so you can crop the motion/trajectory by time and plot that or just get the data from OpenSim and do the cropping/plotting entirely in Matlab. To export data from an OpenSim plot please refer to the documentation page here:
https://simtk-confluence.stanford.edu/d ... d+Printing

If the data resides in an .sto or .mot file then you can use the OpenSim API to read/write data files as described here
https://simtk-confluence.stanford.edu/d ... DatatoFile

Hope this helps,
-Ayman

Re: Gait % and MATLAB

Posted: Tue Jun 29, 2021 1:35 pm
by kernalnet
Hi,

You can import data from MOT or STO files to MATLAB in two ways:
1) By parsing the text file using some functions like dlmread or textscan and etc.
Check this project:
https://simtk.org/frs/download_confirm. ... oup_id=773

2) Using OpenSim API e.g.
Storage(https://simtk.org/api_docs/opensim/api_ ... orage.html),
TimeSeriesTable(https://simtk.org/api_docs/opensim/api_ ... ble__.html)

To normalize the data to % gait, you need to crop the time range and interpolate it to 101 point (0-100 %). interp1 function might be helpful.

Best,
Mohammadreza