Main Content

Model Configuration Parameters: Code Generation Data Type Replacement

The Code Generation > Data Type Replacement category includes parameters for replacing built-in data type names with user-defined names in the generated code. On the Configuration Parameters dialog box, the following configuration parameters are on the Code Generation > Data Type Replacement pane.

ParameterDescription

Data type replacement

Method for replacing Simulink® data types in generated code.

Specify custom data type names

Option to replace data type names determined by code generation settings with user-defined data type names in generated code.

Replacement Name: double

Replacement name for double built-in data type in generated code.

Replacement Name: single

Replacement name for single built-in data type in generated code.

Replacement Name: int32

Replacement name for int32 built-in data type in generated code.

Replacement Name: int16

Replacement name for int16 built-in data type in generated code.

Replacement Name: int8

Replacement name for int8 built-in data type in generated code.

Replacement Name: uint32

Replacement name for uint32 built-in data type in generated code.

Replacement Name: uint16

Replacement name for uint16 built-in data type in generated code.

Replacement Name: uint8

Replacement name for uint8 built-in data type in generated code.

Replacement Name: boolean

Replacement name for boolean built-in data type in generated code.

Replacement Name: int

Replacement name for int built-in data type in generated code.

Replacement Name: uint

Replacement name for uint built-in data type in generated code.

Replacement Name: char

Replacement name for char built-in data type in generated code.

Replacement Name: uint64

Replacement name for uint64 built-in data type in generated code.

Replacement Name: int64

Replacement name for int64 built-in data type in generated code.

These parameters belong to the Advanced parameters category.

ParameterDescription

Boolean false identifier

Identifier for Boolean false value

Boolean true identifier

Identifier for Boolean true value

64-bit integer maximum identifier

Identifier for 64-bit integer data limit maximum

16-bit integer maximum identifier

Identifier for 16-bit integer data limit maximum

32-bit integer maximum identifier

Identifier for 32-bit integer data limit maximum

8-bit integer maximum identifier

Identifier for 8-bit integer data limit maximum

64-bit unsigned integer maximum identifier

Identifier for 64-bit unsigned integer data limit maximum

16-bit unsigned integer maximum identifier

Identifier for 16-bit unsigned integer data limit maximum

32-bit unsigned integer maximum identifier

Identifier for 32-bit unsigned integer data limit maximum

8-bit unsigned integer maximum identifier

Identifier for 8-bit unsigned integer data limit maximum

64-bit integer minimum identifier

Identifier for 64-bit integer data limit minimum

16-bit integer minimum identifier

Identifier for 16-bit integer data limit minimum

32-bit integer minimum identifier

Identifier for 32-bit integer data limit minimum

8-bit integer minimum identifier

Identifier for 8-bit integer data limit minimum

Type limit identifier replacement header file

Header file that defines Boolean and data type limit identifiers

Implement images using OpenCV Mat class

Option to represent images as OpenCV class cv::Mat

Coder typedefs compatibility

Option to force generation of rtwtypes.h.

Configure Simulink Coder Data Type Replacements Programmatically

To programmatically replace the Simulink Coder™ data type names for your model, adjust the ReplacementTypes model parameter, which is a structure. This example code shows how to modify the ReplacementTypes parameter to replace the built-in data type names int8, uint8, and boolean with the custom data type names my_T_S8, my_T_U8, and my_T_BOOL.

model = bdroot;
cs = getActiveConfigSet(model);
set_param(cs,'EnableUserReplacementTypes','on');

struc = get_param(cs,'ReplacementTypes');
struc.int8 = 'my_T_S8';
struc.uint8 = 'my_T_U8';
struc.boolean = 'my_T_BOOL';

set_param(cs,'ReplacementTypes',struc);

Related Topics