@hcat |

Vertically concatenate matrices.

Syntax: @vcat(m1, m2[, m3, ...])

m#: matrix, vector, svector or sym

Return: matrix

Performs vertical concatenation of two matrix objects. Each of the m# must have the same number of columns.

The result will have the same number of rows and sum of the number of columns of the m#.

For example, if m1 is a matrix with m rows and k columns, and m2 is a matrix with m rows and p columns, then @hcat will return a matrix with m rows and (k+p) columns.

Examples

vector v1 = @fill(1, 2, 3)

matrix k1 = @hcat(v1, 2*v1, 3*v1)

produces the matrices K1 and K2 which horizontally join the vectors V1, 2*V1 and 3*V1.

matrix g1 = @mnrnd(3, 3)

sym s1 = @identity(3)

matrix m1 = @hcat(g1, s1, v1)

horizontally joins the random normal matrix G1 on top of the identity matrix, and the vector containing (1, 2, 3).

Cross-references

See also
@vcat.