Reshape 1xn vector with matlab

2019-01-15 21:27发布

Hii i have a vector with a dimension of 1x55 and i want to reshape row by row and get a 11x5 matrix. CAn anyone help me ?

Here´s an example:

A=[1,2,3,4,5,6,7,8,9...55]

after the reshaping

B=[1,2,3,4,5
   6,7,8,9,10
   11,12,13...
   ...      55]

Thanks a lot

2条回答
三岁会撩人
2楼-- · 2019-01-15 22:10

Reshape and transpose:

reshape(A, 5, 11)'
查看更多
爷、活的狠高调
3楼-- · 2019-01-15 22:18

To get the answer you want, you need to reshape to a 5x11 matrix and take the transpose:

B = reshape(A,5,11)';
查看更多
登录 后发表回答