The meta.property object for property Foo has a value of true for its HasDefault
property because Foo does have a default value:
sin(pie/2)
However, this expression returns an error (pie is a function that creates a pie graph, not
the value pi).
mc = ?MyPropEr;
mp = mc.PropertyList(1);
mp.HasDefault
ans =
1
dv = mp.DefaultValue;
Error using pie (line 29)
Not enough input arguments.
Querying the default value causes the evaluation of the expression and returns the error.
Property With Explicitly Defined Default Value of Empty
MyEmptyProp assigns a default of [] (empty double) to the Foo property:
classdef MyEmptyProp
properties
Foo = []
end
end
The meta.property object for property Foo has a value of true for its HasDefault
property. Accessing DefaultValue returns the value []:
mc = ?MyEmptyProp;
mp = mc.PropertyList(1);
mp.HasDefault
ans =
1
dv = mp.DefaultValue;
Find Default Values in Property Metadata