Converting a 4x2 matrix into two 2x2 matrices?
<p>I created a meshgrid and then converted the points to a single vector as follows:</p>

<pre><code>gMax = 1;
gStep = 2;
[g1, g2] = meshgrid(-gMax:gStep:gMax, -gMax:gStep:gMax);
</code></pre>

<p>This gives the following output for g1 and g2:</p>

<pre><code>g1 =

    -1     1
    -1     1

g2 =

    -1    -1
     1     1
</code></pre>

<p>Now if can convert the two matrices into a single matrix as follows:</p>

<pre><code>gridPoints = [g1(:) g2(:)];
</code></pre>

<p>This gives the output:</p>

<pre><code>gridPoints =

    -1    -1
    -1     1
     1    -1
     1     1
</code></pre>

<p>Now my question is: How would I turn the single 4x2 matrix of grid points back into its original form of two 2x2 matrices?</p>