How to convert 1D to 2D by Matlab program

后端 未结 1 643
既然无缘
既然无缘 2020-12-21 08:15

I would like to ask a question about Matlab program.

I have vector a

a = [1 2 3 4 5 6 7 8 9 10 11 12];

I would like to

相关标签:
1条回答
  • 2020-12-21 08:36

    Check out the reshape function and help page.

    In particular,

    B = reshape(A,m,n)
    

    returns the m-by-n matrix B whose elements are taken column-wise from A. An error results if A does not have m*n elements.

    Note that it is column-wise, so I suggest you make a matrix with 3 rows and 4 columns and then tip it on its side (A.' will take the transpose of a matrix).

    0 讨论(0)
提交回复
热议问题