Main Content

Data type replacement

Method for replacing built-in data type names in generated code

Since R2023a

Model Configuration Pane: Code Generation / Data Type Replacement


The Data type replacement parameter specifies the method for replacing Simulink® data types in generated code.


Use C data types with fixed-width integers | Use coder typedefs
Use coder typedefs

The code generator creates the header file rtwtypes.h, which specifies Simulink Coder™ data types that are based on the C89 language standard. The generated code uses Simulink Coder data types for scalar and array variables. For example, the Simulink Coder type real32_T corresponds to the Simulink type single.

This option is selected if you open:

  • A GRT-based model and change System target file from grt.tlc to ert.tlc.

  • A model that was last saved by using R2022b or an earlier release.

Use C data types with fixed-width integers

The generated code uses data types from the C99 language standard, which includes definitions from stdint.h and stdbool.h.

Selecting this option enables the Coder typedefs compatibility (CoderTypedefsCompatibility) check box. By default, the code generator does not create rtwtypes.h because the generated code does not require definitions from rtwtypes.h. If you use custom code that requires Simulink Coder data type definitions, you can force the generation of rtwtypes.h by selecting the Coder typedefs compatibility check box.

This option is selected if:

  • You open an Embedded Coder® template model.

  • For the Shared coder dictionary (EmbeddedCoderDictionary) configuration parameter, you specify a file that contains a service interface configuration.

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionUse C data types with fixed-width integers improves compliance with MISRA C™ and MISRA™ C++ standards.

Programmatic Use

Parameter: DataTypeReplacement
Type: character vector
Value: 'CoderTypedefs' | 'CDataTypesFixedWidth'

Version History

Introduced in R2023a