# Vector Concatenate, Matrix Concatenate

Concatenate input signals of same data type to create contiguous output signal

## Library

Math Operations, Signal Routing

## Description

The Concatenate block concatenates the signals at its inputs to create an output signal whose elements reside in contiguous locations in memory.

 Tip   The Concatenate block is useful for creating an output signal that is nonvirtual. However, to create a vector of function calls, use a Mux block instead.

You use a Concatenate block to define an array of buses. For details about defining an array of buses, see Combine Buses into an Array of Buses.

The Concatenate block operates in either vector or multidimensional array concatenation mode, depending on the setting of its Mode parameter. In either case, the block concatenates the inputs from the top to bottom, or left to right, input ports.

### Vector Mode

In vector mode, all input signals must be either vectors or row vectors [1xM matrices] or column vectors [Mx1 matrices] or a combination of vectors and either row or column vectors. The output is a vector if all inputs are vectors.

The output is a row or column vector if any of the inputs are row or column vectors, respectively.

### Multidimensional Array Mode

Multidimensional array mode accepts vectors and arrays of any size. It assumes that the trailing dimensions are all ones for input signals with lower dimensionality. For example, if the output is 4-D and the input is `[2x3]` (2-D) this block treats the input as `[2x3x1x1]`. The output is always an array. The block's Concatenate dimension parameter allows you to specify the output dimension along which the block concatenates its input arrays.

If you set the Concatenate dimension parameter to `2` and inputs are 2-D matrices, the block performs horizontal matrix concatenation and places the input matrices side-by-side to create the output matrix, for examplefor example:

If you set the Concatenate dimension parameter to `1` and inputs are 2-D matrices, the block performs vertical matrix concatenation and stacks the input matrices on top of each other to create the output matrix, for examplefor example:

For horizontal concatenation, the input matrices must have the same column dimension. For vertical concatenation, the input matrices must have the same row dimension. All input signals must have the same dimension for all dimensions other than the concatenation dimensions.

If you set the Mode parameter to ```Multidimensional array```, the Concatenate dimension parameter to `3`, and the inputs are 2-D matrices, the block performs multidimensional matrix concatenation, for examplefor example:

## Data Type Support

Accepts signals of any data type that Simulink® supports. All inputs must be of the same data type. Outputs have the same data type as the input.

## Parameters and Dialog Box

The parameters and dialog box differ, based on the mode in which the block is operating: vector or matrix. Most parameters exist in both modes.

The dialog box for the Vector Concatenate block appears as follows.

The dialog box for the Matrix Concatenate block appears as follows.

### Number of inputs

Specifies the number of inputs for the block.

#### Settings

Default: `2`

#### Command-Line Information

See Block-Specific Parameters for the command-line information.

### Mode

Select the type of concatenation that this block performs.

#### Settings

Default: `Vector` (for the Vector Concatenate block), `Multidimensional array` (for the Matrix Concatenate block)

`Vector`

Perform vector concatenation (see Vector Mode for details).

`Multidimensional array`

Perform matrix concatenation (see Multidimensional Array Mode for details).

#### Dependency

This parameter enables Concatenate dimension.

#### Command-Line Information

See Block-Specific Parameters for the command-line information.

### Concatenate dimension

Specifies the output dimension along which to concatenate the input arrays.

#### Settings

Default: `2`

• Enter `1` to concatenate input arrays vertically.

• Enter `2` to concatenate input arrays horizontally.

• Enter a higher dimension to perform multidimensional concatenation on the inputs.

#### Dependency

Selecting `Multidimensional array` for Mode enables this parameter.

#### Command-Line Information

See Block-Specific Parameters for the command-line information.

## Characteristics

 Direct Feedthrough Yes Sample Time Inherited from driving block Scalar Expansion No Dimensionalized Yes Multidimensionalized Yes Zero-Crossing Detection No

`cat` in the MATLAB® reference documentation