Generate Code for Export-Function Model - MATLAB & Simulink (original) (raw)
Main Content
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.
- Open an export-function model. For example, use the export-function model created inCreate Export-Function Model.
- On the Simulation tab and from the Prepare section, select Model Settings
.
In the Solver pane, set Solver Type toFixed-step
. In the Code generation pane, setSystem target file toert.tlc
. Requires an Embedded CoderĀ® license. - Display the C Code tab by selecting theApps tab, and then in the Apps section, select Embedded Coder
. On the C Code tab, selectGenerate Code
. Wait for the code building process to complete.
- On the C Code tab, select Open Latest 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
Topics
- Export-Function Models Overview
- Create Export-Function Model
- Test Export-Function Model Simulation Using Input Matrix
- Test Export-Function Model Simulation Using Function-Call Generators
- Test Export-Function Model Simulation Using Stateflow Chart
- Test Export-Function Model Simulation Using Schedule Editor