title: Matlab: getting figure handles into subplots
body: <p>I have two figures with figure handles <code>h1</code> and <code>h2</code>. I'd like to use them as subplots in a single figure and run</p>
  
  <pre><code>figure
  s1=subplot(211);
  s2=subplot(212);
  hc1=get(h1, 'children');
  hcc1=get(hc1, 'children');
  hc2=get(h2, 'children');
  hcc2=get(hc2, 'children');
  set(hcc1,'parent',s1);
  set(hcc2,'parent',s2);
  </code></pre>
  
  <p>This works well for the first figure but not the second (<code>h2</code>), where I get the error</p>
  
  <pre><code>Error using set
  Conversion to double from cell is not possible.
  </code></pre>
  
  <p>The two figures are the same except for details, so I don't understand why. I tried using <code>set(hc2,'parent',s2);</code>, i.e. "one less parent," and also one more, i.e. <code>hccc2=get(hcc2, 'children'); set(hcc2,'parent',s2);</code>, with the same errors. Can anyone see what's going on?</p>