title: How to modify properties of a Matlab Object
body: <p>I've created a MATLAB class, something like:</p>
  
  <pre><code>classdef myclass
  
    properties
        x_array = [];
    end
  
    methods
      function increment(obj,value)
         obj.x_array = [obj.x_array ; value);
      end
    end
  end
  </code></pre>
  
  <p>The problem is, the property <code>x_array</code> is never modified when I invoke the <code>increment()</code> function:
  ex:</p>
  
  <pre><code>&gt;&gt;s = myclass
  &gt;&gt;increment(s,5)
  
  &gt;&gt;s.x_array
  ans = []
  </code></pre>
  
  <p>I did some research, and I reached a conclusion that this is because of MATLAB using Lazy Copy for objects, making my class inherit the HANDLE class should have solved this, but it didn't, does anybody know why this is happening? And if extending the handle class is indeen the solution, isn't this the right way to do it:</p>
  
  <pre><code>classdef myclass &lt; handle
  </code></pre>
  
  <p>or are there any extra steps?</p>