title: How can I reshape this 2D array to a 4D array?
body: <p>I have a 2D array of laminar flame speeds in the form of:</p>
  
  <pre><code>T1 P1 phi1 EGR1 S
  T1 P2 phi1 EGR1 S
  .
  .
  .
  T1 P12 phi1 EGR1 S
  T1 P13 phi1 EGR1 S
  T1 P1 phi2 EGR1 S
  T1 P2 phi2 EGR1 S
  .
  .
  .
  T1 P12 phi2 EGR1 S
  T1 P13 phi2 EGR1 S
  .
  .
  .
  .
  .
  .
  T28 P1 phi5 EGR1 S
  T28 P2 phi5 EGR1 S
  .
  .
  .
  T28 P12 phi5 EGR1 S
  T28 P13 phi5 EGR1 S
  </code></pre>
  
  <p>Where there are 28 different initial temperature (T1 - T28), 13 different initial pressures (P1 - P13), and 5 different fuel-air ratios (phi1 - phi5). EGR level doesn't change (<code>EGR1</code>), and then the resulting flame speed is listed as <code>S</code>.</p>
  
  <p>So this is a 2D array of size (1820,5). I would like to convert it to a 4D array in MATLAB in the form of: A(5,5,13,28). So each page is 5 fuel-air ratios at a specific pressure and temperature, i.e., 5x5. The next page (3rd dimension), changes the pressure to <code>P2</code>, but keeps the temperature the same. Then finally, the 4th dimension increases the initial temperature.</p>
  
  <p>I am familiar with the <code>reshape</code> and <code>permute</code> functions, but just can't seem to get it to what I want. Can anyone lend a hand?</p>