Error while implementing CoordinateCouplerConstraint in Matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
K Sivaprasad
Posts: 5
Joined: Wed May 19, 2021 6:15 pm

Error while implementing CoordinateCouplerConstraint in Matlab

Post by K Sivaprasad » Mon Sep 13, 2021 1:00 am

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.

Tags:

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: Error while implementing CoordinateCouplerConstraint in Matlab

Post by Thomas Uchida » Mon Sep 13, 2021 12:39 pm

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.

POST REPLY