title: Is there a convenient way of turning an existing structure into a script?
body: <p>I have an existing structure array which is loaded into the workspace with a <code>load()</code> statement. The fields contain <code>char</code> and <code>double</code>.</p>
  
  <p>I want to create this structure, including the contents of its fields, in a script instead, but as the structure is large, I don't want to write all the fields and values out by hand.</p>
  
  <p>Dragging the structure fields from the workspace into the editor just copies the field names over.</p>
  
  <p>Is there an easy and convenient way to extract the fields and their values, so that the fields of the structure array</p>
  
  <pre><code>example_struct
  </code></pre>
  
  <p>are turned into statements of the form</p>
  
  <pre><code>example_struct.field1 = &lt;some_value&gt;;
  </code></pre>
  
  <p>which <em>doesn't</em> involve writing a script?</p>
  
  <p>EDIT: I want to write a script (an M-file) which populates a <em>new</em> structure array with actual values. I want to get the statements for that script, including the values, out of an existing structure which I have loaded with <code>load()</code>, but I want to know if that can be done without writing a script (say, using fprintf statements) to perform the task.</p>