How can I list all properties of a dynamicprops object ?

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

Respuestas (1)

Daniel Shub
Daniel Shub el 24 de Oct. de 2011
Can you use: properties
doc properties
Starting from the MATLAB example:
obj = ObjArray;
addprop(obj, 'test');
properties(obj)

2 comentarios

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 ?
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).

Iniciar sesión para comentar.

Categorías

Productos

Etiquetas

Preguntada:

el 23 de Oct. de 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by