Main Content

Data Type Duplicate

Force all inputs to same data type

  • Data Type Duplicate block

Libraries:
Simulink / Signal Attributes
HDL Coder / Signal Attributes

Description

The Data Type Duplicate block forces all inputs to have the same data type. Other attributes of input signals, such as dimension, complexity, and sample time, are independent.

You can use the Data Type Duplicate block to check for consistency of data types among blocks. If all signals do not have the same data type, the block returns an error message.

The Data Type Duplicate block is typically used such that one signal to the block controls the data type for all other blocks. The other blocks are set to inherit their data types via backpropagation.

The block can also be useful in a user created library. These library blocks can be placed in any model, and the data type for all library blocks are configured according to the usage in the model. To create a library block with more complex data type rules than duplication, use the Data Type Propagation block.

Examples

expand all

This example shows how to control data types in your model using the Data Type Duplicate block. In this model, the data type of the Constant block (currently single) drives the data types throughout the model.

The Constant1 block has its Output data type parameter set to Inherit: Inherit via back propagation. Because the Constant1 and Constant blocks are both connected to the Data Type Duplicate block, the Constant1 block can inherit its data type from the Constant block. The Sum block has its Output data type set to Inherit: Same as first input, so it is also able to inherit its data type from the Constant block.

If you change the data type of the Constant block from single to int32, the int32 data type propagates throughout the model.

Ports

Input

expand all

First input signal, specified as a scalar, vector, matrix, or N-D array. If all signals do not have the same data type, the block returns an error message.

Data Types: single | double | half | int8 | int16 | int32 | uint8 | uint16 | uint32 | string | Boolean | fixed point | enumerated

Nth input signal, specified as a scalar, vector, matrix, or N-D array. If all signals do not have the same data type, the block returns an error message.

Data Types: single | double | half | int8 | int16 | int32 | uint8 | uint16 | uint32 | string | Boolean | fixed point | enumerated

Parameters

expand all

Specify the number of inputs to this block as a real-valued positive integer.

Programmatic Use

Block Parameter: NumInputPorts
Type: character vector
Values: real-valued positive integer
Default: '2'

Block Characteristics

Data Types

Boolean | bus | double | enumerated | fixed point | half | integer | single | string

Direct Feedthrough

no

Multidimensional Signals

yes

Variable-Size Signals

yes

Zero-Crossing Detection

no

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 before R2006a