Page 1 of 1

Reading C3D Files Using Matlab

Posted: Thu Oct 03, 2019 7:01 am
by offseyram
Trying to run the file that will help me extract the data from the C3D file using Matlab returns this error:

Error using osimC3D
Error: File: osimC3D.m Line: 239 Column: 4
Illegal use of reserved keyword "methods".

Error in Matlab_Extraction (line 11)
c3d = osimC3D(c3dpath,1);

I am using the file as it is, undoctored.
What should I do to get this up and running without any further hitches?

Re: Reading C3D Files Using Matlab

Posted: Thu Oct 03, 2019 7:16 am
by jimmy
What version of Matlab are you using? The code was built on more recent Matlab versions (2018). Line 239 deals with hidden methods, perhaps you are using an older version of Matlab that doesn't have support for hidden methods in classes. You can either edit osimC3D.m to expose the functions or use some other C3D -> OpenSim methods.

Re: Reading C3D Files Using Matlab

Posted: Thu Oct 03, 2019 7:40 am
by offseyram
Hello James,
I am using the 2018 Matlab. And I realised the "methods" was used in an earlier line but that didn't raise any red flags when running the file so maybe exposing it like you suggested might help. How would I expose it though?

Re: Reading C3D Files Using Matlab

Posted: Thu Oct 03, 2019 8:21 am
by jimmy
Some info on Matlab classes. You can remove the specification of the private methods and just have a single block of functions.

Code would go from this;

Code: Select all

methods
... % User exposed functions
end

methods (Access = private, Hidden = true)
... % Hidden functions not for the User.
end
To this;

Code: Select all

methods
... % User exposed functions
... % Hidden functions not for the User. (Now exposed)
end

Re: Reading C3D Files Using Matlab

Posted: Thu Oct 03, 2019 8:42 am
by offseyram
Great, just tried it, that error is gone. Thanks for the help James