How can I list all properties of a dynamicprops object ?
Afficher commentaires plus anciens
I need to list all the properties of an object with dynamic properties (dynamicprops). I specially have trouble getting a list of all the addprop()'ed properties...
thanks in advance
Réponses (1)
Daniel Shub
le 24 Oct 2011
Can you use: properties
doc properties
Starting from the MATLAB example:
obj = ObjArray;
addprop(obj, 'test');
properties(obj)
2 commentaires
Walter Roberson
le 24 Oct 2011
Daniel, was it you that was struggling with scoping of properties a month or so ago? An issue about public vs private properties?
Anyhow, I just wonder if that is an issue in this present situation: if someone a dynamically added property was marked private, then logically one should not be able to "see" that property from outside the class. I cannot tell whether Agonzalez is trying to work from inside or outside of the classdef ?
Daniel Shub
le 25 Oct 2011
Good point. I am not sure why you would want to, or even if you could, use a private dynamic property, but a more robust solution might be to use metaclass(obj).
Catégories
En savoir plus sur Properties dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!