MATLAB: Converting 2d matrix to 3d

matrixpermutationreshape

Can anyone help me with making a 2D matrix into a 3D matrix?
I have a (71680 x 8) 2d matrix and I need to make a 3D matrix of dimensions (512 x 8 x 140) I need to take (512 x 8) consecutive matrices by row for 140 layers.
Can anyone help me with this? I really appreciate any help

Best Answer

HI Joe,
if I'm not mistaken, it should be
permute(reshape(X, 512, 140, 8), [1 3 2]);
Titus