MATLAB: Reshape a single dimension of matrix

reshape

Hi, I have a matrix A_{mxn}. For each column, I would like to split all the rows into a sxt matrix such that the final matrix looks like B_{{sxt}xn}. Is there a way I can do matrix operations with reshape. A loop is computationally too expensive for large A.

Best Answer

A=reshape(1:24,12,2)
B=reshape(A(:),3,4,2)