title: Can't iterate over field of a struct matlab
body: <p>I am working currently with matlab and I try to extract some data from a <em>struct</em> that I have, but it seems it is not as easy I thought it would be.  </p>
  
  <pre><code>structExample = 1x100000
  fieldnames(structExample)
  
  ans =
  
    6×1 cell array
  
      {'a'}
      {'b'}
      {'c'}
      {'d'}
      {'e'}
      {'f'}
  </code></pre>
  
  <p>I am interested in the values saved in field 'b'. 
  When I type structExample.b it prints out all the values, but when I do  </p>
  
  <pre><code>values = structExample.b
  </code></pre>
  
  <p>It only saves the first values ([1.2,5.33]) . 'b' has double values for example </p>
  
  <blockquote>
    <p>[1.2,5.33], 1x86double, 1x120double ...</p>
  </blockquote>
  
  <p>My aim is to be able to plot them with <em>cdfplot()</em><br>
  So I thought maybe iterate over all values in the field and save them in a separate array. But I don't know how to iterate through it, since structExample.b only takes the first values. Any ideas? </p>
  
  <p>Edit:<br>
  structExample.b(3) returns   </p>
  
  <blockquote>
    <p>Expected one output from a curly brace or dot indexing expression, but
    there were 41817 results.</p>
  </blockquote>