Hi there,
I am currently trying to convert a matlab gait data set from structures into trc and mot files ready to use in opensim.
I have successfully managed to do this with the trc files using TRCFileAdapter however using the same code with STOFileAdapter I am unable to create the mot files as shown in the code and error message below.
I would be extremely grateful for some help on this.
Thanks,
Caitlin
Unsuccessful code
%% Load OpenSim libs
import org.opensim.modeling.*
%Creating opensimtable
opensimTable = osimTableFromStruct(forceStruct_2);
% Define output file name/path
filepath = 'subject_25__walking_4.mot';
% Write the TimeSeriesTableVec3 to file
STOFileAdapter().write(opensimTable, filepath)
error message
Check for incorrect argument data type or missing argument in call to function 'write'.
Error in writing_data_to_mot_from_struct (line 14)
STOFileAdapter().write(opensimTable, filepath)
Successful code
%% Load OpenSim libs
import org.opensim.modeling.*
%Creating opensimtable
opensimTable = osimTableFromStruct(markerStruct_2);
% Add Meta data to the table.
opensimTable.addTableMetaDataString('DataRate','60');
opensimTable.addTableMetaDataString('Units','m');
% Define output file name/path
filepath = 'subject_25__walking_4.trc';
% Write the TimeSeriesTableVec3 to file
TRCFileAdapter().write(opensimTable,filepath)
STOFileAdapter
- Caitlin Edgar
- Posts: 12
- Joined: Thu Mar 17, 2022 2:23 am
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: STOFileAdapter
Hello,
Please use STOFileAdapterVec3 if writing TimeSeriesData of type Vec3, and let us know how it goes.
Best regards,
-Ayman
Please use STOFileAdapterVec3 if writing TimeSeriesData of type Vec3, and let us know how it goes.
Best regards,
-Ayman
- Caitlin Edgar
- Posts: 12
- Joined: Thu Mar 17, 2022 2:23 am
Re: STOFileAdapter
Thank you Ayman, that has worked!