Page 1 of 1

Error while implementing CoordinateCouplerConstraint in Matlab

Posted: Mon Sep 13, 2021 1:00 am
by cyvaa
While implementing setIndependentCoordinateName() in Matlab, I am encountered with some errors, mainly due to the error in format of implementation.

Code Snipet:
------
tri = CoordinateCouplerConstraint();
tri.setDependentCoordinateName('knee_angle_r');
tri.setIndependentCoordinateNames('shk_r');

Error:

No method 'setIndependentCoordinateName' with method signature found for class '.org.opensim.modeling.CoordinateCouplerConstraint'.

How to solve the no matching signature error due to incorrect input? What will be the correct input? Can you give an example? Thank you.

Re: Error while implementing CoordinateCouplerConstraint in Matlab

Posted: Mon Sep 13, 2021 12:39 pm
by tkuchida
The code and error message do not agree. The code says "setIndependentCoordinateNames" [plural] which is, indeed, a method (see the doxygen documentation here: https://simtk.org/api_docs/opensim/api_ ... 73481dc70d) but the argument is an array of strings, not just a single string as appears on line 3 of your code. The error message says "setIndependentCoordinateName" [singular] which does not exist.

You will need to create an array of strings to pass into the "setIndependentCoordinateNames" method. According to the "Scripting Versions of OpenSim C++ API Calls" page in the documentation (https://simtk-confluence.stanford.edu/p ... d=34242607), you can do this in Matlab by creating an object of type "ArrayStr" containing the name of the coordinate.