title: Matlab OOP accessing properties from an object array
body: <p>New to Matlab come from C/C++...... </p>
  
  <p>I have an array of objects and I'm trying to access the values of every single object in the array and concatenate them into one variable. </p>
  
  <pre><code>Class sample 
     properties(GetAccess = 'public', SetAccess ='public')
       ID;
       Value;
     end
  
     methods 
          function obj = sample(id, value)
              obj.ID = id;
              obj.Value = value;
           end
     end
  end 
  </code></pre>
  
  <p>Then I make an matrix containing some of the objects. </p>
  
  <pre><code>x = sample.empty(3,0);
  x(1) = sample(1,3);
  x(2) = sample(1,4);
  x(3) = sample(1,5);
  </code></pre>
  
  <p>Then I want to get all the values from the objects and store them into a new array. </p>
  
  <pre><code>y = x(:).Value;
  </code></pre>
  
  <p>This however fails and only puts the value of x(3) into y..... and:</p>
  
  <pre><code>y(:) = x(:).Value; 
  </code></pre>
  
  <p>Throws an error. </p>
  
  <p>Any help would be appreciated. I know I could do this with loops but I'm trying to do it in the fastest and most efficient way.</p>