| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop |
| Contents | Index |
| Learn more about Real-Time Workshop |
The Real-Time Workshop Custom Code pane includes the following parameters when the Real-Time Workshop product is installed on your system and you select a GRT- or ERT-based target.

| On this page… |
|---|
Real-Time Workshop: Custom Code Tab Overview Use the same custom code settings as Simulation Target Use local custom code settings (do not inherit from main model) |
Create a list of custom C code, directories, source files, and libraries to include in generated files.
Select the type of information to include from the list on the left side of the pane.
Enter a string to identify the specific code, directory, source file, or library.
Click Apply.
Specify whether to use the same custom code settings as those in the Simulation Target > Custom Code pane.
Default: Off
Enables using the same custom code settings as those in the Simulation Target > Custom Code pane.
Disables using the same custom code settings as those in the Simulation Target > Custom Code pane.
| Parameter: RTWUseSimCustomCode |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify if a library model can use custom code settings that are unique from the main model.
Default: Off
Enables a library model to use custom code settings that are unique from the main model.
Disables a library model from using custom code settings that are unique from the main model.
This parameter is available only for library models that contain Embedded MATLAB Function blocks, Stateflow charts, or Truth Table blocks. To access this parameter, select Tools > Open RTW Target in the Embedded MATLAB Editor or Stateflow Editor for your library model.
| Parameter: RTWUseLocalCustomCode |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify a source file of code to appear at the top of generated files.
Default:''
The Real-Time Workshop software places code near the top of the generated model.c or model.cpp file, outside of any function.
| Parameter: CustomSourceCode |
| Type: string |
| Value: any source file name |
| Default: '' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify a header file to include near top of generated file.
Default:''
The Real-Time Workshop software places header file code near the top of the generated model.h header file.
| Parameter: CustomHeaderCode |
| Type: string |
| Value: any header file name |
| Default: '' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify code appearing in an initialize function.
Default: ''
The Real-Time Workshop software places code inside the model's initialize function in the model.c or model.cpp file.
| Parameter: CustomInitializer |
| Type: string |
| Value: any code |
| Default: '' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify code appearing in a terminate function.
Default: ''
Specify code to appear in the model's generated terminate function in the model.c or model.cpp file.
A terminate function is generated only if you select the Terminate function required check box on the Real-Time Workshop pane, Interface tab.
| Parameter: CustomTerminator |
| Type: string |
| Value: any code |
| Default: '' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify a list of include directories to add to the include path.
Default:''
Enter a space-separated list of include directories to add to the include path when compiling the generated code.
Specify absolute or relative paths to the directories.
Relative paths must be relative to the directory containing your model files, not relative to the build directory.
The order in which you specify the directories is the order in which they are searched for header, source, and library files.
Note If you specify a Windows path string containing one or more spaces, you must enclose the string in double quotes. For example, the second and third path strings in the Include directories entry below must be double-quoted: C:\Project "C:\Custom Files" "C:\Library Files" If you set the equivalent command-line parameter CustomInclude, each path string containing spaces must be separately double-quoted within the single-quoted third argument string, for example, >> set_param('mymodel', 'CustomInclude', ...
'C:\Project "C:\Custom Files" "C:\Library Files"') |
| Parameter: CustomInclude |
| Type: string |
| Value: any directory file name |
| Default: '' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify a list of source files to compile and link with the generated code.
Default: ''
Enter a space-separated list of source files to compile and link with the generated code.
Note If you specify a Windows file name string containing one or more spaces, you must enclose the string in double quotes. For example, the second and third name strings in the Source files entry below must be double-quoted: algs.c "div alg.c" "sin alg.c" If you set the equivalent command-line parameter CustomSource, each file name string containing spaces must be separately double-quoted within the single-quoted third argument string, for example, >> set_param('mymodel', 'CustomSource', ...
'algs.c "div alg.c" "sin alg.c"') |
The file name is sufficient if the file is in the current MATLAB directory or in one of the include directories.
| Parameter: CustomSource |
| Type: string |
| Value: any source file name |
| Default: '' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify a list of additional libraries to link with the generated code.
Default: ''
Enter a space-separated list of static library files to link with the generated code.
Note If you specify a Windows file name string containing one or more spaces, you must enclose the string in double quotes. For example, the second and third name strings in the Libraries entry below must be double-quoted: mathutil.lib "op utils.lib" "fx utils.lib" If you set the equivalent command-line parameter CustomLibrary, each file name string containing spaces must be separately double-quoted within the single-quoted third argument string, for example, >> set_param('mymodel', 'CustomLibrary', ...
'mathutil.lib "op utils.lib" "fx utils.lib"') |
The file name is sufficient if the file is in the current MATLAB directory or in one of the include directories.
| Parameter: CustomLibrary |
| Type: string |
| Value: any library file name |
| Default: '' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
![]() | Real-Time Workshop Pane: Symbols | Real-Time Workshop Pane: Debug | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |