title: How do I resize a matrix in MATLAB?
body: <p>Suppose I had a <strong>1-by-12</strong> matrix and I wanted to resize it to a <strong>4-by-3</strong> matrix. How could I do this?</p>
  
  <p>My current solution is kind of ugly:</p>
  
  <pre><code>for n = 1:(length(mat)/3)
      out(n,1:3) = mat( ((n-1)*3 + 1):((n-1)*3 + 3) );
  end
  </code></pre>
  
  <p>Is there a better way to do this?</p>