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

Replace data type names in the generated code

Specify whether to replace built-in data type names with user-defined data type names in generated code.

Replacement Name: double

Specify a name for double built-in data types in generated code.

Replacement Name: single

Specify a name for single built-in data types in generated code.

Replacement Name: int32

Specify a name for int32_T built-in data types in generated code.

Replacement Name: int16

Specify a name for int16_T built-in data types in generated code.

Replacement Name: int8

Specify a name for int8_T built-in data types in generated code.

Replacement Name: uint32

Specify a name for uint32_T built-in data types in generated code.

Replacement Name: uint16

Specify a name for uint16_T built-in data types in generated code.

Replacement Name: uint8

Specify a name for uint8_T built-in data types in generated code.

Replacement Name: boolean

Specify a name for boolean_T built-in data types in generated code.

Replacement Name: int

Specify a name for int_T built-in data types in generated code.

Replacement Name: uint

Specify a name for uint_T built-in data types in generated code.

Replacement Name: char

Specify a name for char_T built-in data types in generated code.

Replacement Name: uint64

Specify a name for uint64_T built-in data types in generated code.

Replacement Name: int64

Specify a name for int64_T built-in data types in generated code.

Configure Data Type Replacements Programmatically

To programmatically replace the built-in 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