To specify an Abstract class as a property for a MATLAB class, you must also specify a default value for the property which is a class that is derived from the abstract class you specified.
The code below demonstrates how the code you provided might be modified to accomplish this workflow.
classdef demoClass
properties
TestProperty matlab.mixin.Heterogeneous = rootClass
end
methods
function obj = demoClass
end
end
end
classdef rootClass < matlab.mixin.Heterogeneous
methods
function obj = rootClass
end
end
end
And now you should be able to instantiate an instance of "demoClass":
>> demoClass
ans =
demoClass with properties
TestProperty: [1×1 rootClass]
Best Answer