title: When is it appropriate to use a cell array vs. a struct in Matlab?
body: <p>If I want to store some strings or matrices of different sizes in a single variable, I can think of two options: I could make a struct array and have one of the fields hold the data,</p>
  
  <pre><code>structArray(structIndex).structField
  </code></pre>
  
  <p>or I could use a cell array,</p>
  
  <pre><code>cellArray{cellIndex}
  </code></pre>
  
  <p>but is there a general rule-of-thumb of when to use which data structure?  I'd like to know if there are downsides to using one or the other in certain situations.</p>