title: How do i define a structure in Matlab
body: <p>I know that a structure can be defined by in several ways such as:</p>
  
  <ol>
  <li><p>Adding fields to a variable</p>
  
  <pre><code>p.color.red = .2;
  p.color.green = .4;
  p.color.blue = .7;
  </code></pre></li>
  <li><p>Defining a scalar structure by assignment</p>
  
  <pre><code>S = struct('a',  0, 'b',  1, 'c',  2);
  </code></pre></li>
  </ol>
  
  <p>What I want to be able to do is create a structure definition (like C).  My end goal is to have an array of structures that i can iterate through and perform testing on.  Is there any way I can define a generic structure and then create instances of it? Should I use some other mechanism.  I know MATLAB supports Java, should I use a class/interface?</p>