title: Matlab arrayfun with array of elements that are [1x4 struct]
body: <p>I have a array, 'MY_STRUCTURES_Array', with single row and N columns. Each element is a [1x4 struct].  I want to extract a numeric valued 'thisField' from each structure of each [1x4 struct] element. </p>
  
  <p>The result I am looking for is a 4xN array of the values for each 'thisField' value, where each row in this result corresponds to a colum in the [1x4 struct].</p>
  
  <p>The code I am using is this:</p>
  
  <pre><code>arrayfun(@(x) (x.thisField),   MY_STRUCTURES_Array);
  </code></pre>
  
  <p>Matlab returns the error</p>
  
  <pre><code>Attempt to reference field of non-structure array.
  </code></pre>
  
  <p>If I put the following in the command line, </p>
  
  <pre><code>MY_STRUCTURES_Array{1}
  </code></pre>
  
  <p>I get a list of all of the fields of the [1x4 struct].</p>
  
  <p>If I put this in the command line,</p>
  
  <pre><code>MY_STRUCTURES_Array{1}.thisField
  </code></pre>
  
  <p>I get four answers, like this:</p>
  
  <pre><code>ans =
  
         1
  
  
  ans =
  
         1
  
  
  ans =
  
         1
  
  
  ans =
  
         0
  </code></pre>
  
  <p>If I look at the size</p>
  
  <pre><code>size(MY_STRUCTURES_Array{1}.thisField)
  </code></pre>
  
  <p>Matlab says "Error using size", so I see this is not an array. But I'm not sure what it is.</p>
  
  <p>I am not sure how to proceed to get the 4xN array I am looking for.</p>
  
  <p>UPDATE</p>
  
  <p>Output from command MY_STRUCTURES_Array returns a row array of [1x4 struct].</p>
  
  <p>Output from whos MY_STRUCTURES_Array{1} returns nothing</p>
  
  <p>Output from whos MY_STRUCTURES_Array returns:</p>
  
  <pre><code> Name                     Size               Bytes  Class    Attributes
  
   MY_STRUCTURES_Array      1x103            1371136  cell      
  </code></pre>
  
  <p>Output from whos MY_STRUCTURES_Array{1}.thisField returns nothing</p>
  
  <p>Output from MY_STRUCTURES_Array{1}.thisField was shown in the original post.</p>