I have some classes that I created a couple of constant properties for. Here is some example code:
classdef genericClassName < handle
properties (Constant)
Name = 'genericClassName'
Description = 'description of the class'
end
...
In the main code I create objects by assigning the class handle, which in this case comes from a pre-assigned value delivered from a separate function. It would be like
fuctionModel = @genericClassName;
and later I'll create other objects and pass the value of functionModel to those classes. Up to this point, it all works fine.
The Matlab documentation says that these constant properties are accessed like this:
genericClassName.Name
genericClassName.Description
I can type that into the command line and it produces the desired result, giving the value of the Name or Description property - the same values assigned to the constant properties. However, I only have the handle, which is saved in functionModel as @genericClassName.
This is my question: How can I refer to this class and its constant properties when I only have the handle, with its at-sign prepended?
Update Short of a simpler or concise answer, a combination of the answers from @Edric and @CrisLuengo seems to work. For instance:
mc=meta.class.fromName(func2str(functionalModel));
result = eval([mc.Name '.Description']);
puts the constant with the name Description into the variable result. This is usable for what I need, and I'll probably just wrap it into a function.