1
votes

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
Did you try help reshape? Or lookfor reshape?nhowe
yes i did but i cant find a way to make it work. by using the reshape function it always does it by columns not rowsuser2292821
What else did you try, and what were the failed results?Jeremy

2 Answers

3
votes

Reshape and transpose:

reshape(A, 5, 11)'
1
votes

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

B = reshape(A,5,11)';