Page 1 of 1

STOFileAdapter.read() not available

Posted: Mon May 18, 2020 12:09 pm
by ruthmei
Hi everybody,
my university updated the student computers which means that I need to switch from OpenSim 4.0 to 4.1. I developed over the last month my own motion capture analysis in OpenSim using the coding possibilities in Matlab.

Prior to the conversion, my code ran without any problems in OpenSim 4.0 which was integrated in Matlab 2018b.
Now, the new computers are equipped with Matlab 2019b and OpenSim 4.1.
And only now I am facing some issues with the exact same code: It throws an error when I want to use STOFileAdapter.read(filepathofmotfile).
Undefined function 'read' for input arguments of type 'org.opensim.modeling.STOFileAdapter'.
Before the update, this code ran fine.

So to check, I used "methodsview(STOFileAdapter)" in both Matlab versions to verify.
Indeed, in Matlab 2018b (integrated with OpenSim 4.0) the function "read" is listed.
In Matlab2019b with OpenSim 4.1 the function "read" is missing, which means that this function obviously cannot be found by Matlab. If I check with the API for STOFileAdapter (https://simtk.org/api_docs/opensim/api_ ... ter__.html) "read" should still be available.

So my question is: Did anyone else face this issue when changing to 4.1?
Has there been an update and am I supposed to use another function to read in a *.mot-file?
Or might this possibly be a bug?

Thank you :)
Best regards,
Ruth

Re: STOFileAdapter.read() not available

Posted: Mon May 18, 2020 12:46 pm
by aymanh
Hi Ruth,

Sorry about the confusion. The method 'read' still exists but the signature has changed to be consistent across all Adapters, so instead of using a "custom" read method for each Adapter, they all use the same generic signature that takes a source/filename and returns a list of Tables.

You'll likely not need to use this generic read method altogether but rather construct a table directly from the sto file as described here
https://simtk-confluence.stanford.edu/d ... g+Commands
under the section Reading data files. You'll use TimeSeriesTable, or TimeSeriesTableVec3 depending on the data you have in the file.

Hope this helps,
-Ayman

Re: STOFileAdapter.read() not available

Posted: Mon May 18, 2020 2:11 pm
by ruthmei
Hi Ayman,

thanks for this advice, it worked :)