Page 1 of 1

Converting c3d to mot

Posted: Fri Feb 01, 2019 11:57 am
by rodmateus
Hello there!

I was trying to get into the issue of converting a c3d file to be used in opensim. Since it is the first time I do this step ( in my works with opensim I received the .mot files), I used the matlab scripts from the project from felipe alvim (https://simtk.org/projects/c3d2opensim). To get confortable with the code, I used the SLTHT in the same project, however, I can not get rid of this error in Matlab:

Undefined function 'adapta_nomes_coordgen' for input arguments of type 'cell'.

Error in c3d2OS (line 151)
lista_nomes_coordgen2 = adapta_nomes_coordgen (lista_nomes_coordgen1);

How do I get around this?

Best regards,

Rodrigo Mateus

Re: Converting c3d to mot

Posted: Fri Feb 08, 2019 11:01 am
by jimmy
The project you linked seems to be pretty old and I wouldn't expect the functions to still work with OpenSim 4.0.

You could try to use the in-built methods of 4.0 with the included Matlab classes to perform the transform. Documentation for setting your Matlab environment is here and documentation for the C3D adapter is here.

I think I read somewhere that you are using Matlab 2014-- just be aware that OpenSim 4.0 is 64-bit and that must match your Matlab version (Matlab must be 64- it version)

Re: Converting c3d to mot

Posted: Wed Feb 20, 2019 12:18 am
by saylee.p
jimmy wrote:
Fri Feb 08, 2019 11:01 am
The project you linked seems to be pretty old and I wouldn't expect the functions to still work with OpenSim 4.0.

You could try to use the in-built methods of 4.0 with the included Matlab classes to perform the transform. Documentation for setting your Matlab environment is here and documentation for the C3D adapter is here.

I think I read somewhere that you are using Matlab 2014-- just be aware that OpenSim 4.0 is 64-bit and that must match your Matlab version (Matlab must be 64- it version)
Dear sir,
I have configured MATLAB with Opensim successfully. Also I have extracted some c3d files using example script "c3dExport.m". But some c3d files I could not convert to trc and mot due to some error as follows.
1. Illegal Column label.*119 changed to _119
Invalid field name :'_119'.
(this is error from utility osimTableToStruct(Line 94))

2. Java exception occurred:

I have added pictures of errors since I am working on different computer and on that I am not allowed any connectivity access.

Re: Converting c3d to mot

Posted: Wed Feb 20, 2019 10:14 am
by jimmy
The error is related to some renaming issues found here. Unnamed markers in the C3D are given the name "*N" where N is a number. The Matlab function tries to rename that too "_N", but underscores are illegal at the beginnning of the Matlab Struct members.

You could fix this in one of two ways; (i) delete all the unnamed markers in your C3D, or (ii) edit the local version of the Matlab Script to change '*' characters to something like 'm' ( "*119" -> "m119").

A fix will be included in the next OpenSim update, but that may be awhile.

Re: Converting c3d to mot

Posted: Thu Feb 21, 2019 2:07 am
by saylee.p
jimmy wrote:
Wed Feb 20, 2019 10:14 am
(ii) edit the local version of the Matlab Script to change '*' characters to something like 'm' ( "*119" -> "m119").

A fix will be included in the next OpenSim update, but that may be awhile.
this solved the error.
Thank you.