0
votes

I have a matrix Data. i want to reshape this matrix into 32 matrices of dimension 128x14.

4096/32

ans =

   128

size(Data)

ans =

    4096          14

How can i do this by using reshape?

1

1 Answers

1
votes

It's simply:

out = reshape(data, 128, 14, 32);

You will get 32 2D matrices placed into a 3D matrix where each slice is 128 x 14. Be aware of how MATLAB will create this matrix. The elements will be populated in column major order, so it will take columns of your data matrix and stack them from left to right until you get 14 columns of 128. It then moves to the next slice in your 3D matrix and picks up where it left off until we run out of elements.