Main Content

Vector Concatenate

Concatenate input vectors of same data type for iterative processing

  • Vector Concatenate block

Libraries:
Simulink / Commonly Used Blocks
Simulink / Math Operations
Simulink / Signal Routing
HDL Coder / Math Operations
HDL Coder / Signal Routing

Alternative Configurations of Vector Concatenate Block:
Matrix Concatenate

Description

The Vector Concatenate block concatenates input signals to create a nonscalar signal that you can iteratively process with a subsystem, for example, a for-each, while-iterator, or for-iterator subsystem.

You can use multiple Vector Concatenate blocks to create the output signal in stages, but the result is flat, as if you used a single block to concatenate the signals.

The signals in the output signal appear in the same order as the input signals for the block. For a description of the port order for various block orientations, see Identify Port Location on Rotated or Flipped Block.

You must use a Vector Concatenate or Matrix Concatenate block to define an array of buses. For more information, see Group Nonvirtual Buses in Arrays of Buses.

Examples

expand all

A Vector Concatenate block concatenates the vectors it receives, placing them side-by-side in the output vector.

For example, simulate the VectorConcatenation model.

The input vectors [1 2] and [3 4] are concatenated to create the output vector [1 2 3 4].

Extended Examples

Ports

Input

expand all

First input to concatenate, specified as a scalar, vector, matrix, or array.

  • Inputs must be of the same data type.

  • Matrix and array inputs are supported only when you set Mode to Multidimensional array.

When the data type is a Simulink.Bus object, the inputs must be nonvirtual buses.

Data Types: single | double | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus | image

Nth input to concatenate, specified as a scalar, vector, matrix, or array.

  • Inputs must be of the same data type.

  • Matrix and array inputs are supported only when you set Mode to Multidimensional array.

Dependencies

To add input ports, set Number of inputs to an integer greater than or equal to 2.

Data Types: single | double | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus | image

Output

expand all

Concatenation of input signals along specified dimension. Outputs have the same data type as the input.

Data Types: single | double | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus | image

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Specify the number of inputs for the block as a real-valued, positive integer, less than or equal to 65536.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: NumInputs
Values: '2' (default) | positive integer in quotes
Data Types: char | string

Example: set_param(gcb,'NumInputs','3')

Select whether the block operates in vector or multidimensional array concatenation mode. The default Mode of the Vector Concatenate block is Vector. The default Mode of the Matrix Concatenate block is Multidimensional array.

  • When you select Vector, the block performs vector concatenation.

  • When you select Multidimensional array, the block performs matrix concatenation.

Mode SettingInput SignalsOutput Signal
Vector

  • Vectors

  • Row vectors (1-by-M matrices)

  • Column vectors (M-by-1 matrices)

  • Combination of vectors and either row or column vectors

When all inputs are vectors, the output is a vector.

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

Multidimensional array

Signals of any dimensionality (scalars, vectors, and matrices)

The output is always an array.

Trailing dimensions are assumed to be 1 for lower dimensionality inputs. For example, if the output is 4-D and the input is [2x3] (2-D), this block treats the input as [2x3x1x1].

Concatenation is on the dimension that you specify with the Concatenate dimension parameter.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: Mode
Values: 'Vector' | 'Multidimensional array'

Example: set_param(gcb,'Mode','Vector')

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

  • 1 — Concatenate inputs vertically. The vertical matrix concatenation stacks the input matrices on top of each other in the output matrix. When you insert a Vector Concatenate block and set Mode to Multidimensional array, the default is 1.

  • 2 — Concatenate inputs horizontally. The horizontal matrix concatenation places the input matrices side-by-side in the output matrix. When you insert a Matrix Concatenate block, the default is 2.

  • 3 or more — Perform multidimensional concatenation on the inputs.

The input matrices must have compatible sizes for concatenation. Vertical concatenation requires the input matrices to have the same number of columns. Horizontal concatenation requires input matrices to have the same number of rows.

Dependencies

To enable this parameter, set Mode to Multidimensional array.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: ConcatenateDimension
Values: scalar integer in quotes
Data Types: char | string

Example: set_param(gcb,'ConcatenateDimension','3')

Block Characteristics

Data Types

Boolean | double | enumerated | fixed point | half | image | integer | single

Direct Feedthrough

yes

Multidimensional Signals

no

Variable-Size Signals

yes

Zero-Crossing Detection

no

Alternative Configurations

expand all

The Matrix Concatenate block sets Mode to Multidimensional array.

Libraries:
Simulink / Math Operations
Simulink / Matrix Operations
DSP System Toolbox / Math Functions / Matrices and Linear Algebra / Matrix Operations
HDL Coder / Math Operations

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced in R2009b