Split 3d matrix into multiple 2d matrices
<p>I have a 3x1 cell array that looks like this:</p>

<pre><code>x={rand(256,901,160);rand(256,901,160);rand(256,901,160)};

    [256x901x160 double]
    [256x901x160 double]
    [256x901x160 double]
</code></pre>

<p>I'd like to take the 3rd dimension and split it into 160 different 2d matrices, so 160 [256x901] matrices. I want to do this because i have written different functions that take in 2d matrices.</p>

<p>my desired output would be a 3x160 cell array containing matrices of 256x901. </p>

<p>I know i need to use reshape or mat2cell but I'm not too sure on the syntax.</p>

<p>EDIT</p>

<p>I found a slower way to do it but its not great..</p>

<pre><code>for i = 1:length(x)
    for k = 1:160
      y{:,k}= x{i}(:,:,k);
    end
 end
</code></pre>

<p>any suggestions to improve speed?</p>