This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Convert Data Types in Simulink Models

This example shows three different methods of converting data types in your model using the Data Type Conversion and Data Type Conversion Inherited blocks. In this model, a Sine Wave block generates the input signal. The Sine Wave block only outputs double-precision data types, so to generate a sine wave with a data type of single, you must perform a data type conversion.

In the first row, the Data Type Conversion Inherited block uses the data type coming from the Constant block (single) as the reference data type, and converts the sine wave to single.

In the second row, the Data Type Conversion block has the Output data type set to single, and the sine wave is converted accordingly.

In the third row, the Data Type Conversion1 block has the Output data type set to Inherit: Inherit via back propagation. Because the downstream Gain2 block has a data type of single, the Data Type Conversion1 block converts the sine wave to a data type of single.