Include headers
R2026bInclude custom code in the generated model header file
Model Configuration Pane: Code Generation / Custom Code
Description
Specify custom code to include near the top of the generated model header file.
Settings
'' (default) | stringThe code generator places this code near the top of the generated header file. If you are including a header file, in your custom header file add model.h#ifndef code. This avoids linker errors and multiple inclusions. For example, in rtwtypes.h the following #include guards are added:
#ifndef RTW_HEADER_rtwtypes_h_ #define RTW_HEADER_rtwtypes_h_ ... #endif /* RTW_HEADER_rtwtypes_h_ */
Tips
To use the same custom code settings as those used for simulation, select Use the same custom code settings as Simulation Target. For more information, see Integrate External Code by Using Model Configuration Parameters.
Recommended Settings
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Programmatic Use
Parameter: CustomHeaderCode |
| Type: character vector |
| Value: C code |
Default: '' |
Version History
Introduced before R2006a