If I run this code to create a simple class:
classdef myclass
properties
m = 2;
n = m + 2;
end
end
I get an error:
Undefined function or variable 'm'.
Error in myclass (line 1)
classdef myclass
Why is this? I left out the constructor in this minimal example because a) the error still occurs if I put the constructor in, and b) I encountered this error in a unit testing class, and the constructor isn't called in such classes in MATLAB 2013b.