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.
Error while implementing CoordinateCouplerConstraint in Matlab
- K Sivaprasad
- Posts: 5
- Joined: Wed May 19, 2021 6:15 pm
- Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Re: Error while implementing CoordinateCouplerConstraint in Matlab
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.
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.