Main Content

Data Interfaces

Model Code Interfaces lists modeling elements that you can use to represent interfaces for interacting with target environment resources. To configure the modeling elements for code generation, in the Code Mappings editor or by using the code mappings programming interface, you map the interface elements represented in the model to data code interfaces.

C Data Interfaces

When using Simulink® Coder™ to generate code, you map model data interface elements to storage classes. A storage class specifies the appearance and placement of data elements in the generated code.

To represent data interface elements in a model and configure them for code generation:

  1. In the model, include data interface elements as recommended in Model Code Interfaces.

  2. Open the Simulink Coder app.

  3. If you want to set up default mappings for categories of model elements, select Code Interface > Default Code Mappings. In the Code Mappings editor, on the Data Defaults and Function Defaults tabs, configure default mappings.

  4. Select Code Interface > Individual Element Code Mappings.

  5. In the Code Mappings editor, on each element category tab, inspect the mappings and property settings for individual interface elements. If necessary, adjust the settings.

  6. Save your interface configuration changes by saving the model.

If you prefer, you can map data elements to storage classes by using the code mappings programming interface (see coder.mapping.api.CodeMapping).

For more information, see Code Mappings editor and Data and Function Interfaces.