stack

stack(...) - Stack function

Returns an vector or matrix formed by placing arguments top to bottom. Arguments are arrays having the same number of columns or they are scalars and column vectors.

In the case of scalar values the stack function returns a column vector containing the list of arguments.

stack1

In the next example three column vectors a, b, and c are input as arguments to the stack function.

stack2

In order to obtain a matrix the vectors must be in row order. The three row vectors d, f, and g are input as arguments to the stack function.

stack3

The row vectors can easily be translated to columns in the matrix by applying the matrix transpose to the stack function.

stack4

See also augment

Return to Functions page