This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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®.

To create the model for this example, see Create Export-Function Model.

Generate Code for Exported Functions

Generate code from the model that contains the functions.

  1. Open the export-function model.

  2. From the menu, select Simulation > Model Configuration Parameters.

  3. In the Solver pane, set Solver Type to Fixed-step.

  4. In the Code generation pane, set System target file to ert.tlc. Requires an Embedded Coder® license.

  5. From the Simulink menu, Select Code > C/C++ Code > Build Model. Wait for the code building process to complete.

  6. Select Code > C/C++ Code > Code Generation 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.

See Also

Blocks

Related Topics