title: Reshape matrix from 3d to 2d keeping rows
body: <p>I am transforming a 3d matrix into a 2d matrix. This is the shape transformation: [n x m x o] -> [n*o x m]. </p>
  
  <p>The elements of the matrices are row-related. Thus, it is required to have the same rows in the resulting matrix.</p>
  
  <pre><code>A = rand(2,2,3);
  </code></pre>
  
  <p>Doing this:</p>
  
  <pre><code>C = reshape(A, 2*3, 2);
  </code></pre>
  
  <p>is not keeping the rows in A.</p>
  
  <p>So I do this:</p>
  
  <pre><code>B = zeros(size(A,1)*size(A,3),size(A,2));
  first_indice = 1;
  for i = 1:size(A,3)
      B(first_indice:size(A,1)*i,:)=A(:,:,i);
      first_indice = first_indice + size(A,1);
  end
  </code></pre>
  
  <p>Is there a more efficient way maybe using reshape?</p>
  
  <p>Thanks a lot!</p>