MATLAB: Class with dynamic properties but no handle

classconstructordynamicpropshandleMATLABobjectoopparameterupdatevalue

Hi,
This might seem like a stupid thing to ask but humour me:
I have a class (call it ParameterClass) that is a subclass of the dynamicprops handle class. Thus I can add properties dynamically which is what I want. ParameterClass is also a property of another object, call it testcase.
Because ParameterClass is a subclass of a handle class, it itself becomes a handle class.
Inside a GUI object I want to store multiple instances of the testcase object, thus multiple references to the ParameterClass, but I want the ParameterClass to stop being a handle class as I would like to be able to update a property of ParameterClass in a certain instance of a testcase and I don't want that change to be reflected in all other testcase objects.
So my question essentially is how do I go from a handle class to a value class? Is there another way of adding dynamic properties to a class without it becoming a handle class?
Hope this question makes sense.
Thank you for your help,
Alex.

Best Answer

"like a stupid thing to ask" No that's definately a good question that deserves an answer.
"how do I go from a handle class to a value class?" You cannot do that with an instance of a handle class. And you don't need to.
I assume that you in the properties block of the class, testcase, have assigned an instance of ParameterClass as default value. If so, that's what causing the unwanted behavior.
The solution is to assign the default value from within the constructor of testcase. See