It is easier to see the reason for this issue once you fully-qualify the name of an instance variable with which you are defining another.
e.g.
classdef Example
properties
A = {'a','b','c'}
B = [Example.A,'d']
end
end
yields the error
Invalid default value for property 'B' in class 'Example':
The property 'A' in class 'Example' must be accessed from a class instance because it is not a Constant property.
Because 'B' is defined in terms of A, we must either define 'A' to be a "Constant" property or we must initialize B in the constructor.
i.e.
classdef Example
properties (Constant)
A = {'a','b','c'}
end
properties
B = [Example.A,'d']
end
end
or
classdef Example
properties
A = {'a','b','c'}
B
end
methods
function obj = Example()
obj.B = [obj.A,'d'];
end
end
end
Best Answer