Search code examples
oopmatlabpropertiesobserver-pattern

Get a list of observable properties


i know how to use the command 'properties' to get a list of all properties that an object has. Is there a way to get a list of only the properties that are observable?


Solution

  • Use metaclass information, and look for the properties that have the SetObservable attribute:

    mc = meta.class.fromName('MyClass');
    idx = [mc.PropertyList.SetObservable];
    pnames = {mc.PropertyList.Name};
    pnames = pnames(idx)
    

    Same can be done for GetObservable attribute