Documentation

Simulation Target Pane: General

Simulation Target: General Tab Overview

Configure the simulation target for a model that contains MATLAB Function blocks, Stateflow® charts, or Truth Table blocks.

Configuration

Set the parameters that appear.

Tip

To open the Simulation Target pane, in the Simulink® Editor, select Simulation > Model Configuration Parameters > Simulation Target.

See Also

Parse custom code symbols

Specify whether or not to parse the custom code and report unresolved symbols in a model. This setting applies to all C charts in the model, including library link charts.

Settings

Default: On

On

Enables parsing of custom code to report unresolved symbols in C charts of your model.

Off

Disables parsing of custom code.

Tips

  • When you create a new model, this check box is selected by default.

  • When you load models saved as version R2010a or earlier, this check box is selected only if the MEX compiler is lcc. Otherwise, the check box is not selected.

  • This option only applies to C charts, not charts that use MATLAB® as the action language.

Command-Line Information

Parameter: SimParseCustomCode
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

ApplicationSetting
DebuggingOn
TraceabilityNo impact
EfficiencyNo impact
Safety precautionOn

See Also

Source file

Enter code lines to appear near the top of a generated source code file.

Settings

Default: ' '

Code lines appear near the top of the generated model.c source file, outside of any function.

Command-Line Information

Parameter: SimCustomSourceCode
Type: string
Value: any C code
Default: ''

Recommended Settings

ApplicationSetting
Debugging

No recommendation

Traceability

No recommendation

Efficiency

No recommendation

Safety precaution

No recommendation

See Also

Header file

Enter code lines to appear near the top of a generated header file.

Settings

Default: ' '

Code lines appear near the top of the generated model.h header file.

Tips

  • When you include a custom header file, enclose the file name in double quotes. For example, #include "sample_header.h" is a valid declaration for a custom header file.

  • You can include extern declarations of variables or functions.

Command-Line Information

Parameter: SimCustomHeaderCode
Type: string
Value: any C code
Default: ''

Recommended Settings

ApplicationSetting
Debugging

No recommendation

Traceability

No recommendation

Efficiency

No recommendation

Safety precaution

No recommendation

See Also

Initialize function

Enter code statements that execute once at the start of simulation.

Settings

Default: ' '

Code appears inside the model's initialize function in the model.c file.

Tip

  • Use this code to invoke functions that allocate memory or to perform other initializations of your custom code.

Command-Line Information

Parameter: SimCustomInitializer
Type: string
Value: any C code
Default: ''

Recommended Settings

ApplicationSetting
Debugging

No recommendation

Traceability

No recommendation

Efficiency

No recommendation

Safety precaution

No recommendation

See Also

Terminate function

Enter code statements that execute at the end of simulation.

Settings

Default: ' '

Code appears inside the model's terminate function in the model.c file.

Tip

  • Use this code to invoke functions that free memory allocated by the custom code or to perform other cleanup tasks.

Command-Line Information

Parameter: SimCustomTerminator
Type: string
Value: any C code
Default: ''

Recommended Settings

ApplicationSetting
Debugging

No recommendation

Traceability

No recommendation

Efficiency

No recommendation

Safety precaution

No recommendation

See Also

Include directories

Specify a list of folder paths that contain files you include in the compiled target.

Settings

Default:''

Enter a space-separated list of folder paths.

  • Specify absolute or relative paths to the directories.

  • Relative paths must be relative to the folder containing your model files, not relative to the build folder.

  • 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 SimUserIncludeDirs, each path string containing spaces must be separately double-quoted within the single-quoted third argument string, for example,

    >> set_param('mymodel', 'SimUserIncludeDirs', ...
                 'C:\Project "C:\Custom Files" "C:\Library Files"')

Command-Line Information

Parameter: SimUserIncludeDirs
Type: string
Value: any folder path
Default: ''

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precaution

No recommendation

See Also

Source files

Specify a list of source files to compile and link into the target.

Settings

Default:''

You can separate source files with a comma, a space, or a new line.

Limitation

This parameter does not support Windows file names that contain embedded spaces.

Tip

  • The file name is sufficient if the file is in the current MATLAB folder or in one of the include directories.

Command-Line Information

Parameter: SimUserSources
Type: string
Value: any file name
Default: ''

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precaution

No recommendation

See Also

Libraries

Specify a list of static libraries that contain custom object code to link into the target.

Settings

Default:''

Enter a space-separated list of library files.

Limitation

This parameter does not support Windows file names that contain embedded spaces.

Tip

  • The file name is sufficient if the file is in the current MATLAB folder or in one of the include directories.

Command-Line Information

Parameter: SimUserLibraries
Type: string
Value: any library file name
Default: ''

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precaution

No recommendation

See Also

Reserved names

Enter the names of variables or functions in the generated code that match the names of variables or functions specified in custom code for a model that contains MATLAB Function blocks, Stateflow charts, or Truth Table blocks.

Settings

Default: {}

This action changes the names of variables or functions in the generated code to avoid name conflicts with identifiers in custom code. Reserved names must be shorter than 256 characters.

Tips

  • Start each reserved name with a letter or an underscore to prevent error messages.

  • Each reserved name must contain only letters, numbers, or underscores.

  • Separate the reserved names using commas or spaces.

  • You can also specify reserved names by using the command line:

    config_param_object.set_param('SimReservedNameArray', {'abc','xyz'})

    where config_param_object is the object handle to the model settings in the Configuration Parameters dialog box.

Command-Line Information

Parameter: SimReservedNameArray
Type: string array
Value: any reserved names shorter than 256 characters
Default: {}

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precaution

No recommendation

See Also

Defines

Specify preprocessor macro definitions to be added to the compiler command line.

Settings

Default: ''

Enter a list of macro definitions for the compiler command line. Specify the parameters with a space-separated list of macro definitions. If a makefile is generated, these macro definitions are added to the compiler command line in the makefile. The list can include simple definitions (for example, -DDEF1), definitions with a value (for example, -DDEF2=1), and definitions with a space in the value (for example, -DDEF3="my value"). Definitions can omit the -D (for example, -DFOO=1 and FOO=1 are equivalent). If the toolchain uses a different flag for definitions, the code generator overrides the -D and uses the appropriate flag for the toolchain.

Command-Line Information

Parameter: SimUserDefines
Type: string
Value: preprocessor macro definition
Default: ''

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precaution

No recommendation

See Also

Configure Model for External Code Integration

Was this topic helpful?