title: matlab - what is the equivalent of null / None / nil / NULL etc.?
body: <p>In most OO languages, where variables may point to objects, they may also have a null value, which is highly convenient.</p>
  
  <p>In Matlab, I have a function which parses a command, and then returns a cell array, or <code>false</code> (which is equal to zero — which is another common pattern) if it fails:</p>
  
  <pre><code>function re = parse(s)
      ...
      if (invalid)
          re = false;
          return;
      end
  end
  </code></pre>
  
  <p>The problem is that when I check the result, it gives an error:</p>
  
  <pre><code>re = parse(s);
  if (false == re)
  Undefined function 'eq' for input arguments of type 'cell'.
  </code></pre>
  
  <p>I've written a function to check it without an error: <code>strcmp('logical', class(re)) &amp;&amp; false == re</code>, but that seems to be really slow for use in hot areas of the code, and also inconvenient if I have to add this function to every M file I'm writing.</p>
  
  <p>Using <code>NaN</code> is even worse, because besides throwing that error, it also isn't equal to itself.</p>
  
  <p>What's a better alternative for use with this pattern?</p>