matlab - How to reshape a vector to make a matrix? -


this question has answer here:

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

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -