Main Content

Generate Code for Export-Function Model

You generate code for independent functions from an export-function model, not the simulation test model (harness). After generating the function code, you can integrate the functions with a scheduler that you hand-code externally from Simulink® software.

Generate Code for Exported Functions

Generate code from the model that contains the functions.

  1. Open an export-function model. For example, use the export-function model created in Create Export-Function Model.

  2. On the Simulation tab and from the Prepare section, select Model Settings .

    In the Solver pane, set Solver Type to Fixed-step. In the Code generation pane, set System target file to ert.tlc. Requires an Embedded Coder® license.

  3. Display the C Code tab by selecting the Apps tab, and then in the Apps section, select Embedded Coder . On the C Code tab, select Generate Code . Wait for the code building process to complete.

  4. On the C Code tab, select Open Latest Report.

    Entry-point functions in report

In the generated code, each root-level function-call Inport block generates a void-void function. The function name is the name of the output signal from the block. If there is no signal name, then the function name is derived from the name of the block. In this example, the function name was derived from the block name.

File export_function_model.c

See Also

Related Topics