Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
Henry Winter
- Posts: 3
- Joined: Sat May 02, 2020 10:26 pm
Post
by Henry Winter » Wed Sep 09, 2020 10:20 pm
Hi everyone,
Using OpenSim 4.1, I'm trying to use the read function of the TRCFileAdapter class to import the data from a .trc file into Matlab using the code:
Code: Select all
trctimeSeriesTable = org.opensim.modeling.TRCFileAdapter.read("W101.trc");
running the above, however, returns this error:
Code: Select all
Check for missing argument or incorrect argument data type in call to function 'read'.
From what I understand from reading the API (
https://simtk.org/api_docs/opensim/api_ ... apter.html), there is only one input argument required which is a string, which I believe I am inputting correctly. Am I mistaken? Or is there something I'm missing? I don't have a lot of experience with C++ syntax.
I'd appreciate any and all help with the issue.
-
Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Post
by Dimitar Stanev » Thu Sep 10, 2020 1:26 am
Hi Henry,
Your approach seems OK and the API call is correct. I would try to create the TRCFileAdapter first, because it is a class object and then read the file. Maybe Matlab expects that TRCFileAdapter is constructed since classes expect an implicit "self" argument that must be passed to the constructor (do not bother to understand this). You can try the following:
Code: Select all
trcAdapter = org.opensim.modeling.TRCFileAdapter()
trctimeSeriesTable = trcAdapter.read("W101.trc")
-
Ayman Habib
- Posts: 2255
- Joined: Fri Apr 01, 2005 12:24 pm
Post
by Ayman Habib » Thu Sep 10, 2020 9:31 am
Hi Henry,
The read method is part of the generic interface that returns a collection of TimeSeriesTable(s) that you need to dig into in order to fish out the TimeSeriesTable of interest. The recommended way to avoid this altogether is to construct the TimeSeriesTable of the specific type directly from the file as described here:
https://simtk-confluence.stanford.edu/d ... DatatoFile
Hope this helps,
-Ayman
-
Henry Winter
- Posts: 3
- Joined: Sat May 02, 2020 10:26 pm
Post
by Henry Winter » Fri Sep 11, 2020 10:48 pm
Thanks Ayman, your solution worked. I appreciate the help.