title: Dynamically add a field to an object in matlab
body: <p>Say I have a MATLAB object defined in a class file</p>
  
  <pre><code>classdef foo
  
     properties
        bar
     end
  
  end
  </code></pre>
  
  <p>And I create a foo object</p>
  
  <pre><code>myfoo = foo();
  </code></pre>
  
  <p>Now I want to add another field to foo dynamically.  What I want is</p>
  
  <pre><code>myfoo.newfield = 42;
  </code></pre>
  
  <p>but this will throw an error.  </p>
  
  <p>I know there is a way to dynamically add a field/property to a MATLAB object but I can't remember it or find it easily in the help.  Anyone know the syntax?</p>