matlab - How to reshape a vector to make a matrix? -
this question has answer here:
- reshaping of array in matlab 3 answers
here have:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
and here want get:
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]
the number of rows , columns (3 , 4 in example) known.
how that?
this guide says
mat = vec2mat(vec,matcol) converts vector vec matrix matcol columns, creating 1 row @ time. if length of vec not multiple of matcol, zeros placed in last row of mat. matrix mat has ceil(length(vec)/matcol) rows.
Comments
Post a Comment