title: Extracting cells from struct in Matlab?
body: <p>Consider the following code in Matlab</p>
  
  <pre><code>for h=1:2
      B=randn(3,2);
      C=randn(3,2);
      A={B C}; 
      baseA_.A=A;
      eval(['baseA.A' num2str(h) '= baseA_;'])
  end
  
  clearvars -except baseA
  </code></pre>
  
  <p>Now in each iteration <code>h</code> of a loop I want to extract the <code>1x2</code> cell inside the struct <code>Ah</code>.</p>
  
  <p>I have tried</p>
  
  <pre><code>for h=1:2
      indA=sprintf('A%d', h); 
      Acell = struct2cell(baseA.(indA));
  
  end
  </code></pre>
  
  <p>but <code>Acell</code> is a <code>1x1</code> cell containing a <code>1x2</code> cell. I want directly <code>Acell</code> equal to the <code>1x2</code> cell. Any suggestion?</p>