title: Why does MATLAB throw an "undefined variable" error when I try to assign a class property to another class property in the properties block?
body: <p>If I run this code to create a simple class:</p>
  
  <pre><code>classdef myclass
      properties
          m = 2;
          n = m + 2;
      end
  end
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>Undefined function or variable 'm'.
  Error in myclass (line 1)
  classdef myclass 
  </code></pre>
  
  <p>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.</p>