Set value of AbstractProperty
Posted: Tue Jan 28, 2020 9:49 pm
I need to change the value of an object's property programmatically using MATLAB API
The object is a custom controller defined in a plugin dll, so I can't use safeDownCast to use concrete methods, as explained here:
viewtopicPhpbb.php?f=91&t=7281&p=19121&start=0&view=
I can load a model containing the custom controller just fine and access the gain I want to adjust as an AbstractProperty
The only two relevant AbstractProperty methods i see in methodsview() are updValueAsObject(index) and setValueAsObject(index) neither of which seem to work:
Doesnt look like correct MATLAB syntax, but was suggested in another post
viewtopicPhpbb.php?f=91&t=10913&p=30255&start=0&view=
The "Container Interface" section here
https://simtk.org/api_docs/opensim/api_ ... perty.html
Thanks in advance!
The object is a custom controller defined in a plugin dll, so I can't use safeDownCast to use concrete methods, as explained here:
viewtopicPhpbb.php?f=91&t=7281&p=19121&start=0&view=
I can load a model containing the custom controller just fine and access the gain I want to adjust as an AbstractProperty
Code: Select all
controller=model.getControllerSet.get('CustomReflexController');
gain=controller.updPropertyByName('gain');
Code: Select all
gain.updValueAsObject(0)=5
Unrecognized property 'updValueAsObject' for class 'org.opensim.modeling.AbstractProperty'.
viewtopicPhpbb.php?f=91&t=10913&p=30255&start=0&view=
Code: Select all
gain.updValueAsObject(0)
Java exception occurred:
java.lang.RuntimeException: SimpleProperty<T>::updValueAsObject(): property gain is not an Object property.
at org.opensim.modeling.opensimModelJNI.AbstractProperty_updValueAsObject__SWIG_0(Native Method)
at org.opensim.modeling.AbstractProperty.updValueAsObject(AbstractProperty.java:96)
https://simtk.org/api_docs/opensim/api_ ... perty.html
Thanks in advance!