Communications Toolbox    
vec2mat

Convert a vector into a matrix

Syntax

Description

mat = vec2mat(vec,matcol) converts the vector vec into a matrix with matcol columns, creating one row at a time. If the length of vec is not a multiple of matcol, then extra zeros are placed in the last row of mat. The matrix mat has ceil(length(vec)/matcol) rows.

mat = vec2mat(vec,matcol,padding) is the same as the first syntax, except that the extra entries placed in the last row of mat are not necessarily zeros. The extra entries are taken from the matrix padding, in order. If padding has fewer entries than are needed, then the last entry is used repeatedly.

[mat,padded] = vec2mat(...) returns an integer padded that indicates how many extra entries were placed in the last row of mat.

Examples

See Also
reshape


  syndtable vitdec