The ability to retrieve the names of Private Dynamic properties is not available in MATLAB R2009a.
As the name suggests, dynamic properties are dynamically added so that means that at some point in time (when you actually add the property) the name should be known. Please make sure you do not lose track of the name at that point. A way to ensure this could be to write you own superclass which keeps track of the property names and derive your class from this class instead of from dynamicprops; an example of such a super class is given below:
classdef mydynamicprops < dynamicprops
properties (Access=private)
dynpropnames
end
methods
function y=addprop(obj,pname)
obj.dynpropnames{end+1} = pname;
y=addprop@dynamicprops(obj,pname);
end
function y=GetDynamicProperties(obj)
y=obj.dynpropnames;
end
end
end
Best Answer