Subclass calls to superclass constructors cannot be part of other expressions, contained in conditional statements, or made after references to the object.
The following code illustrates some examples of invalid superclass constructor calls because of the use of brackets, parentheses, or conditional statements.
classdef MyClass < A & B
methods
function obj = MyClass
obj = [obj@A] % Invalid call to A constructor
(obj@B) % Invalid call to B constructor
if 1
obj@B % Invalid conditional call to B constructor
end
end
end
end
Correct the syntax on the indicated line. For more information on how to call the superclass constructor, see No Conditional Calls to Superclass Constructors.