Gait % and MATLAB

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Andrea Vivaldi
Posts: 2
Joined: Wed Feb 24, 2021 6:48 am

Gait % and MATLAB

Post by Andrea Vivaldi » Mon Jun 21, 2021 1:12 pm

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!

Tags:

User avatar
Ayman Habib
Posts: 2244
Joined: Fri Apr 01, 2005 12:24 pm

Re: Gait % and MATLAB

Post by Ayman Habib » Tue Jun 22, 2021 12:01 pm

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

User avatar
Mohammadreza Rezaie
Posts: 404
Joined: Fri Nov 24, 2017 12:48 am

Re: Gait % and MATLAB

Post by Mohammadreza Rezaie » Tue Jun 29, 2021 1:35 pm

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

POST REPLY