Main Content

Model Source

Specify external source code

Description

For a model that includes the Model Source block, the code generator adds external code that you specify to the source file (model.c or model.cpp) that it generates. You can specify code for the code generator to add near the top and bottom of the source file.

If you include this block in a referenced model, the code generator ignores the block for simulation target builds, but processes the block for other system target files.

  • Model Source block

Parameters

expand all

Specify code that you want the code generator to add near the top of the source file for the model. The code generator places the code in the section labeled user code (top of source file).

Specify code that you want the code generator to add at the bottom of the source file for the model. The code generator places the code in the section labeled user code (bottom of source file).

Introduced in R2006a