| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
The Optimization pane includes the following parameters:


The Optimization pane includes the following parameters when the Real-Time Workshop product is installed on your system and you select a GRT-based target.

The Optimization pane includes the following parameters when the Real-Time Workshop product is installed on your system and you select an ERT-based target. ERT-based target optimizations require a Real-Time Workshop® Embedded Coder™ license when generating code.

The Optimization pane includes the following parameters when Real-Time Workshop and Stateflow® products are both installed on your system, and the model includes Stateflow charts or Embedded MATLAB™ Function blocks.

Set up optimizations for a model's active configuration set. Optimizations are set for both simulation and code generation.
Set the parameters displayed.
Real-Time Workshop optimizations appear only when the Real-Time Workshop product is installed on your system. Selecting a GRT-based or ERT-based system target file changes the available options. ERT-based target optimizations require a Real-Time Workshop Embedded Coder license when generating code.
Stateflow software optimizations appear only when Real-Time Workshop and Stateflow products are both installed on your system and the model includes Stateflow charts or Embedded MATLAB Function blocks. The settings you make for the Stateflow software options also apply to all Embedded MATLAB Function blocks in the model. You do not need a Stateflow license to use Embedded MATLAB Function blocks.
Reduce execution time by collapsing or removing groups of blocks.
Default: On
Simulink software searches for and reduces the following block patterns:
Accumulators — A group consisting of a Constant block, a Sum block, and feedback through a Unit Delay block.
Redundant type conversions — Unnecessary type conversion blocks, such as an int type conversion block with an input and output of type int.
Dead code — Blocks or signals in an unused code path.
Fast-to-slow Rate Transition block in a single-tasking system — Rate Transition blocks with an input frequency faster than its output frequency.
Simulink software does not search for block patterns that can be optimized. Simulation and generated code are not optimized.
When you select Block reduction, Simulink software collapses certain groups of blocks into a single, more efficient block, or removes them entirely. This results in faster execution during model simulation and in generated code.
Block reduction does not change the appearance of the source model.
Tunable parameters do not prevent a block from being reduced by dead code elimination.
Once block reduction takes place, Simulink software does not display the sorted order for blocks that have been removed.
Block reduction is intended to remove only the generated code that represents execution of a block. Other supporting data, such as definitions for sample time and data types might remain in the generated code.
Accumulators. Simulink software recognizes the block diagram shown in the following figure as an accumulator:

An accumulator construct is recognized anywhere across a block diagram, or within subsystems at lower levels.
With the Block reduction option enabled, Simulink software creates a synthesized block, Sum_synth_accum. The synthesized block replaces the previous block diagram, resulting in a simple increment calculation.
Dead Code Elimination. Any blocks or signals in an unused code path are eliminated from generated code.
The following conditions need to be met for a block to be considered part of an unused code path:
All signal paths for the block end with a block that does not execute. Examples of blocks that do not execute include Terminator blocks, disabled Assertion blocks, S-Function blocks configured for block reduction, and To Workspace blocks when MAT-file logging is disabled for code generation.
No signal paths for the block include global signal storage downstream from the block.
Tunable parameters do not prevent a block from being reduced by dead code elimination.
Consider the signal paths in the following block diagram.

If you check Block reduction, Real-Time Workshop software responds to each signal path as follows:
| For Signal Path... | Real-Time Workshop Software... |
|---|---|
| In1 to Out1 | Always generates code because dead code elimination conditions are not met. |
| In2 to Terminator | Never generates code because dead code elimination conditions are met. |
| In3 to Scope | Generates code if MAT-file logging is enabled and eliminates code if MAT-file logging is disabled. |
| Parameter: BlockReduction |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | Off (for simulation and during development) No impact (for production code generation) |
| Traceability | Off |
| Efficiency | On |
| Safety precaution | Off |
Improve model execution when the model contains Switch and Multiport Switch blocks.
Default: On
Executes only the blocks required to compute the control input and the data input selected by the control input. This optimization speeds execution of code generated from the model. Limits to Switch block optimization:
Only blocks with -1 (inherited) or inf (Constant) sample time can participate.
Blocks with outputs flagged as test points cannot participate.
No multirate block can participate.
Blocks with states cannot participate.
Only S-functions with option SS_OPTION_CAN_BE_CALLED_CONDITIONALLY set can participate.
Executes all blocks driving the Switch block input ports at each time step.
| Parameter: ConditionallyExecuteInputs |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | On |
| Efficiency | On |
| Safety precaution | Off |
Transform tunable parameters into constant values.
Default: Off
Selecting Inline parameters has the following effects:
Real-Time Workshop software uses the numerical values of model parameters, instead of their symbolic names, in generated code.
Reduces global RAM usage, because parameters are not declared in the global parameters structure.
Enables the Configure button. Clicking the Configure button opens the Model Parameter Configuration dialog box.
Uses symbolic names for model parameters in generated code.
Simulink software allows you to override the Inline parameters option for parameters whose values are defined by variables in the MATLAB workspace. To specify that such a parameter remain tunable, specify the parameter as global in the Model Configuration Parameters dialog box (see Model Parameter Configuration Dialog Box). To display the dialog box, click the adjacent Configure button.
To tune a global parameter, change the value of the corresponding workspace variable and select Update Diagram (Ctrl+D) from the Simulink Edit menu.
You cannot tune inlined parameters in code generated from a model. However, when simulating a model, you can tune an inlined parameter if its value derives from a workspace variable. For example, suppose that a model has a Gain block whose Gain parameter is inlined and equals a, where a is a variable defined in the model's workspace. When simulating the model, Simulink software disables the Gain parameter field, preventing you from using the block's dialog box to change the gain. However, you can still tune the gain by changing the value of a at the MATLAB command line and updating the diagram.
When a top model uses referenced models:
All referenced models must specify Inline parameters to be on.
The top model can specify Inline parameters to be on or off.
See Inline Parameter Requirements for more information.
If your model contains an Environment Controller block, you can suppress code generation for the branch connected to the Sim port if you select Inline parameters and the branch does not contain external signals.
This parameter enables:
Configure button
| Parameter: InlineParams |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | Off (for simulation and during development) On (for production code generation) |
| Traceability | On |
| Efficiency | On |
| Safety precaution | No impact |
Controls the output data type of blocks that generate logic signals.
Default: On
Blocks that generate logic signals output a signal of boolean data type. This reduces the memory requirements of generated code.
Blocks that generate logic signals output a signal of double data type. This ensures compatibility with models created by earlier versions of Simulink software.
Setting this option on reduces the memory requirements of generated code, because a Boolean signal typically requires one byte of storage compared to eight bytes for a double signal.
Setting this option off allows the current version of Simulink software to run models that were created by earlier versions of Simulink software that supported only signals of type double.
This optimization affects the following blocks:
Logical Operator block – This parameter affects only those Logical Operator blocks whose Output data type parameter specifies Logical. If this parameter is selected, such blocks output a signal of boolean data type; otherwise, such blocks output a signal of double data type.
Relational Operator block – This parameter affects only those Relational Operator blocks whose Output data type parameter specifies Logical. If this parameter is selected, such blocks output a signal of boolean data type; otherwise, such blocks output a signal of double data type.
Combinatorial Logic block – If this parameter is selected, Combinatorial Logic blocks output a signal of boolean data type; otherwise, they output a signal of double data type. See Combinatorial Logic in the Simulink Reference for an exception to this rule.
Hit Crossing block – If this parameter is selected, Hit Crossing blocks output a signal of boolean data type; otherwise, they output a signal of double data type.
This parameter is disabled for models created with a version of Simulink software that supports only signals of type double.
| Parameter: BooleanDataType |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | On |
Reuse signal memory.
Default: On
Simulink software reuses memory buffers allocated to store block input and output signals, reducing the memory requirement of your real-time program.
Simulink software allocates a separate memory buffer for each block's outputs. This makes all block outputs global and unique, which in many cases significantly increases RAM and ROM usage.
This option applies only to signals with storage class Auto.
Signal storage reuse can occur only among signals that have the same data type.
Clearing this option can substantially increase the amount of memory required to simulate large models.
Clear this option if you need to:
Debug a C-MEX S-function
Use a Floating Scope or a Display block with the Floating display option selected to inspect signals in a model that you are debugging
Simulink software opens an error dialog if Signal storage reuse is enabled and you attempt to use a Floating Scope or floating Display block to display a signal whose buffer has been reused.
This parameter enables:
| Parameter:OptimizeBlockIOStorage |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | Off |
| Efficiency | On |
| Safety precaution | No impact |
Specify how long (in days) an application that contains blocks depending on elapsed or absolute time should be able to execute before timer overflow.
Default: inf
Min: Must be greater than
zero
Max: inf
Enter a positive (nonzero) scalar value (for example, 0.5) or inf.
If you are licensed for the Real-Time Workshop Embedded Coder product and select an ERT target for your model, the default value for Application lifespan (days) is 1.
This parameter is ignored when you are operating your model in external mode, have Mat-file logging enabled, or have a continuous sample time because a 64 bit timer is required in these cases.
Specifying a lifespan, along with the simulation step size, determines the data type used by blocks to store absolute time values.
For simulation, setting this parameter to a value greater than the simulation time will ensure time does not overflow.
Simulink software evaluates this parameter first against the model workspace. If this does not resolve the parameter, Simulink software then evaluates it against the base workspace.
The Application lifespan also determines the word size used by timers in the generated code, which can lower RAM usage. For more information, see Timing Services in the Real-Time Workshop documentation.
Application lifespan, when combined with the step size of each task, determines the data type used for integer absolute time for each task, as follows:
If your model does not require absolute time, this option affects neither simulation nor the generated code.
If your model requires absolute time, this option optimizes the word size used for storing integer absolute time in generated code. This ensures that timers do not overflow within the lifespan you specify. If you set Application lifespan to inf, two uint32 words are used.
If your model contains fixed-point blocks that require absolute time, this option affects both simulation and generated code.
For example, using 64 bits to store timing data enables models with a step size of 0.001 microsecond (10E-09 seconds) to run for more than 500 years, which would rarely be required. To run a model with a step size of one millisecond (0.001 seconds) for one day would require a 32-bit timer (but it could continue running for 49 days).
A timer will allocate 64 bits of memory if you specify a value of inf.
To minimize the amount of RAM used by time counters, specify a lifespan no longer than necessary.
Must be the same for top and referenced models.
Optimize the size of counters used to compute absolute and elapsed time.
| Parameter: LifeSpan |
| Type: string |
| Value: positive (nonzero) scalar value or inf |
| Default: 'inf' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Finite value |
| Safety precaution | inf |
The Simulink® Fixed Point™ software performs net slope correction using integer division to handle net slopes that are reciprocals of integers when simplicity and accuracy conditions are met.
Default: Off
Perform net slope correction using integer division when simplicity and accuracy conditions are met.
Perform net slope correction using integer multiplication followed by shifts.
This optimization affects both simulation and code generation.
When a change of fixed-point slope is not a power of two, net slope correction is necessary. Normally, net slope correction uses an integer multiplication followed by shifts. Enabling this new optimization replaces the multiplication and shifts with an integer division under certain simplicity and accuracy conditions.
Performing net slope correction using integer division is not always more efficient than using multiplication followed by shifts. Ensure that the target hardware supports efficient division.
To ensure that this optimization occurs, you must:
Set the word length of the block to ensure that the software can perform division using the production target long data type. This avoids using multiword operations.
Set the Signed integer division rounds to configuration parameter setting on the Hardware Implementation > Embedded Hardware subpane to Zero or Floor. The optimization does not occur if this parameter is set to Undefined.
Set the Integer rounding mode parameter of the block to Simplest or to the value of the Signed integer division rounds to configuration parameter setting on the Hardware Implementation > Embedded Hardware subpane.
This parameter requires a Simulink Fixed Point license.
| Parameter: UseIntDivNetSlope |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On (when target
hardware supports efficient division) Off (otherwise) |
| Safety precaution | No impact |
Control how parameter data is generated for reusable subsystems.
Default: Hierarchical
Generates a separate header file, defining an independent parameter structure, for each subsystem that meets the following conditions:
The subsystem's Real-Time Workshop system code parameter is set to Reusable function.
The subsystem does not violate any code reuse limitations.
The subsystem does not access parameters other than its own (such as parameters of the root-level model).
Each subsystem parameter structure is referenced as a substructure of the root-level parameter data structure, creating a structure hierarchy.
Generates a single, flat parameter data structure. Subsystem parameters are defined as fields within the structure. A nonhierarchical data structure can reduce compiler padding between word boundaries, producing more efficient compiled code.
This parameter appears only for ERT-based targets.
This parameter requires a Real-Time Workshop Embedded Coder license when generating code.
This parameter is enabled by Inline parameters.
| Parameter: InlinedParameterPlacement |
| Type: string |
| Value: 'Hierarchical' | 'NonHierarchical' |
| Default: 'Hierarchical' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | Hierarchical |
| Efficiency | NonHierarchical |
| Safety precaution | No impact |
Specify whether block signals are declared locally or globally.
Default: On
If it is not possible to declare an output as a local variable, the generated code declares the output as a global variable.
If you are constrained by limited stack space, you can turn Enable local block outputs off and still benefit from memory reuse.
This parameter requires a Real-Time Workshop license.
This parameter is enabled by Signal storage reuse.
| Parameter: LocalBlockOutputs |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | No impact |
Specify how the Real-Time Workshop software handles casting of intermediate variables in mixed-bit systems.
Default: Off (GUI), 'on' (command-line)
Real-Time Workshop software collapses block computations into a single expression, avoiding casts of intermediate variables.
Explicitly downcasts the results of 8- and 16-bit integer expressions.
To ensure consistency between simulation and code generation, the results of 8 and 16-bit integer expressions must be explicitly downcast.
Expressions involving 8- and 16-bit arithmetic are less likely to overflow in code than they are in simulation. Therefore, it is good practice to clear Ignore integer downcasts in folded expressions for safety, to ensure that answers obtained from generated code are consistent with simulation results.
This parameter requires a Real-Time Workshop license.
| Parameter: EnforceIntegerDowncast |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
Note The command-line values are reverse of the settings values. Therefore, 'on' in the command line corresponds to the description of "Off" in the settings section, and 'off' in the command line corresponds to the description of "On" in the settings section. |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | Off |
Collapse block computations into single expressions.
Default: On
Enables expression folding.
Eliminates local variables, incorporating the information into the main code statement.
Improves code readability and efficiency.
Disables expression folding.
This parameter requires a Real-Time Workshop license.
This parameter is enabled by Signal storage reuse.
| Parameter: ExpressionFolding |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | No impact (for simulation and during development) Off (for production code generation) |
| Efficiency | On |
| Safety precaution | No impact |
Reuse existing global variables to store temporary results.
Default: Off
Writes data for block outputs to global variables, reducing RAM consumption and execution time.
Writes data for block outputs to local variables.
This parameter requires a Real-Time Workshop license.
This parameter is enabled by Signal storage reuse.
| Parameter: EnhancedBackFolding |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | Off |
| Efficiency | On |
| Safety precaution | On |
Replace multiply operations in array indices when accessing arrays in a loop.
Default: Off
In array indices, replace multiply operations with add operations when accessing arrays in a loop in the generated code. When the original signal is multidimensional, the Real-Time Workshop Embedded Coder generates one-dimensional arrays, resulting in multiply operations in the array indices. Using this setting eliminates costly multiply operations when accessing arrays in a loop in the C/C++ program. This optimization (commonly referred to as strength reduction) is particularly useful if the C/C++ compiler on the target platform does not have similar functionality. No appearance of multiply operations in the C/C++ program does not imply that the C/C++ compiler does not generate multiply instructions.
Leave multiply operations in array indices when accessing arrays in a loop.
This parameter:
Requires a Real-Time Workshop Embedded Coder license to generate code.
Appears only for ERT-based targets.
| Parameter: StrengthReduction |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | No impact |
Specify whether Real-Time Workshop software reuses signal memory.
Default: On
Real-Time Workshop software reuses signal memory whenever possible, reducing stack size where signals are being buffered in local variables.
Selecting this parameter trades code traceability for code efficiency.
Signals are stored in unique locations.
This parameter requires a Real-Time Workshop license.
This parameter is enabled by Signal storage reuse.
| Parameter: BufferReuse |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | Off |
| Efficiency | On |
| Safety precaution | No impact |
Transform symbolic names of invariant signals into constant values.
Default: Off
Real-Time Workshop software uses the numerical values of model parameters, instead of their symbolic names, in generated code. An invariant signal is not inlined if it is nonscalar, complex, or the block inport the signal is attached to takes the address of the signal.
Uses symbolic names of model parameters in generated code.
This parameter requires a Real-Time Workshop license.
This parameter is enabled by Inline parameters.
| Parameter: InlineInvariantSignals |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | Off |
| Efficiency | On |
| Safety precaution | No impact |
Specify whether Boolean signals are stored as one–bit bitfields or as a Boolean data type.
Note You cannot use this optimization when you generate code for a target that specifies an explicit structure alignment. |
Default: Off
Stores Boolean signals into one–bit bitfields in global block I/O structures or DWork vectors. This will reduce RAM, but might cause more executable code.
Stores Boolean signals as a Boolean data type in global block I/O structures or DWork vectors.
This parameter:
Requires a Real-Time Workshop Embedded Coder license.
Appears only for ERT-based targets.
| Parameter: BooleansAsBitfields |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | No impact |
Specify the minimum signal or parameter width for which a for loop is generated.
Default: 5
Specify the array size at which the code generator begins to use a for loop instead of separate assignment statements to assign values to the elements of a signal or parameter array.
When there are perfectly nested loops, the code generator uses a for loop if the product of the loop counts for all loops in the perfect loop nest is greater than or equal to the threshold.
This parameter requires a Real-Time Workshop license.
| Parameter: RollThreshold |
| Type: string |
| Value: any valid value |
| Default: '5' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | >0 |
| Safety precaution | >1 |
Optimize code generated for vector assignment by replacing for loops with memcpy.
Default: On
Enables use of memcpy for vector assignment based on the associated threshold parameter Memcpy threshold (bytes). memcpy is used in the generated code if the number of array elements times the number of bytes per element is greater than or equal to the specified value for Memcpy threshold (bytes). One byte equals the width of a character in this context.
Disables use of memcpy for vector assignment.
This parameter requires a Real-Time Workshop license.
When selected, this parameter enables the associated parameter Memcpy threshold (bytes).
| Parameter: EnableMemcpy |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | No impact |
Specify the minimum array size in bytes for which memcpy function calls should replace for loops in the generated code for vector assignments.
Default: 64
Specify the array size, in bytes, at which the code generator begins to use memcpy instead of for loops for vector assignments.
This parameter requires a Real-Time Workshop license.
This parameter is enabled when you select Use memcpy for vector assignment.
| Parameter: MemcpyThreshold |
| Type: integer |
| Value: any valid quantity of bytes |
| Default: 64 |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Accept default or determine target-specific optimal value |
| Safety precaution | No impact |
Specify how a reusable subsystem passes outputs.
Default: Structure reference
Passes reusable subsystem outputs as a pointer to a structure stored in global memory.
Passes each reusable subsystem output argument as an address of a local, instead of as a pointer to an area of global memory containing all output arguments. This option reduces global memory usage and eliminates copying local variables back to global block I/O structures. When the signals are allocated as local variables, there may be an increase in stack size. If the stack size increases beyond a level that you want, use the default setting. The maximum number of output arguments passed individually is 12.
This parameter:
Requires a Real-Time Workshop Embedded Coder license.
Appears only for ERT-based targets.
| Parameter: PassReuseOutputArgsAs |
| Type: string |
| Value: 'Structure reference' | 'Individual arguments' |
| Default: 'Structure reference' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | Individual arguments |
| Safety precaution | No impact |
Specify whether to generate initialization code for root-level inports and outports set to zero.
Default: Off (GUI), 'on' (command-line)
Does not generate initialization code for root-level inports and outports set to zero.
Generates initialization code for all root-level inports and outports. You should use the default:
To ensure that memory allocated for C MEX S-function wrappers is initialized to zero
For safety-critical applications that require that all internal and external data be initialized to zero
This parameter appears only for ERT-based targets.
This parameter requires a Real-Time Workshop Embedded Coder license when generating code.
| Parameter: ZeroExternalMemoryAtStartup |
| Type: string |
| Value: 'off' | 'on' |
| Default: 'on' |
Note The command-line values are reverse of the settings values. Therefore, 'on' in the command line corresponds to the description of "Off" in the settings section, and 'off' in the command line corresponds to the description of "On" in the settings section. |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | Off |
Specify whether to generate code that explicitly initializes floating-point data to 0.0.
Default: On (GUI), 'off' (command-line)
Uses memset to clear internal storage for floating-point data to integer bit pattern 0 (all bits 0), regardless of type. An example of a case for selecting this option is to gain compiler efficiency when the compiler and target CPU both represent floating-point zero with the integer bit pattern 0.
Generates code to explicitly initialize storage for data of types float and double to 0.0. The resulting code is slightly less efficient than code generated when you select the option.
You should not select this option if you need to ensure that memory allocated for C MEX S-function wrappers is initialized to zero.
This parameter requires a Real-Time Workshop license.
| Parameter: InitFltsAndDblsToZero |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
Note The command-line values are reverse of the settings values. Therefore, 'on' in the command line corresponds to the description of "Off" in the settings section, and 'off' in the command line corresponds to the description of "On" in the settings section. |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On (GUI), 'off' (command-line) |
| Safety precaution | No impact |
Specify whether to generate initialization code for internal work structures, such as block states and block outputs, to zero.
Default: Off (GUI), 'on' (command-line)
Does not generate code that initializes internal work structures to zero. An example of when you might select this parameter is to test the behavior of a design during warm boot—a restart without full system reinitialization.
Selecting this parameter does not guarantee that memory is in a known state each time the generated code begins execution. When you run a model or generated S-function multiple times, each run can produce a different answer, even when calling the model initialization function in an attempt to reset memory.
If want to get the same answer on every run from a generated S-function, enter the command clear SFcnNam or clear mex in the MATLAB Command Window before each run.
Generates code that initializes internal work structures to zero. You should use the default:
To ensure that memory allocated for C MEX S-function wrappers is initialized to zero
For safety critical applications that require that all internal and external data be initialized to zero
This parameter appears only for ERT-based targets.
This parameter requires a Real-Time Workshop Embedded Coder license when generating code.
| Parameter: ZeroInternalMemoryAtStartup |
| Type: string |
| Value: 'off' | 'on' |
| Default: 'on' |
Note The command-line values are reverse of the settings values. Therefore, 'on' in the command line corresponds to the description of "Off" in the settings section, and 'off' in the command line corresponds to the description of "On" in the settings section. |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | Off |
Specify whether to generate initialization code for blocks that have states.
Default: on
Suppresses generation of initialization code for blocks that have states unless the blocks are in a system that can reset its states, such as an enabled subsystem. This results in more efficient code, but requires that you not refer to the model from a Model block that resides in a system that resets states. If you violate this constraint, Simulink software reports an error, in which case you can disable this optimization.
Generates initialization code for all blocks that have states. Disable this option if the current model includes a subsystem that resets states, such as an enabled subsystem, and the model is referred to from another model with a Model block.
This parameter appears only for ERT-based targets.
This parameter requires a Real-Time Workshop Embedded Coder license when generating code.
You must disable this option if your model includes enabled subsystem and model is referred to from another model with Model block.
| Parameter: OptimizeModelRefInitCode |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | No impact |
Remove wrapping code that handles out-of-range floating-point to integer conversion results.
Default: Off
Removes code when out-of-range conversions occur. Select this check box if code efficiency is critical to your application and the following conditions are true for at least one block in the model:
Computing the outputs or parameters of a block involves converting floating-point data to integer or fixed-point data.
The Saturate on integer overflow check box is cleared in the Block Parameters dialog box.
Results for simulation and execution of generated code match when out-of-range conversions occur. The generated code is larger than when you select this check box.
Selecting this check box reduces the size and increases the speed of the generated code at the cost of potentially producing results that do not match simulation in the case of out-of-range values.
Selecting this check box affects code generation results only for out-of-range values and cannot cause code generation results to differ from simulation results for in-range values.
This parameter requires a Real-Time Workshop license.
| Parameter: EfficientFloat2IntCast |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | Off |
| Efficiency | On |
| Safety precaution | Off (for simulation and during development) On (for production code generation) |
Remove code that handles floating-point to integer conversion results for NaN values.
Default: On
Removes code when mapping from NaN to integer zero occurs. Select this check box if code efficiency is critical to your application and the following conditions are true for at least one block in the model:
Computing outputs or parameters of a block involves converting floating-point data to integer or fixed-point data.
The Saturate on integer overflow check box is selected in the Block Parameters dialog box.
Results for simulation and execution of generated code match when mapping from NaN to integer zero occurs. The generated code is larger than when you select this check box.
Selecting this check box reduces the size and increases the speed of the generated code at the cost of producing results that do not match simulation in the case of NaN values.
Selecting this check box affects code generation results only for NaN values and cannot cause code generation results to differ from simulation results for any other values.
This parameter requires a Real-Time Workshop license.
For ERT-based targets, this parameter is enabled when you select the floating-point numbers and non-finite numbers check boxes in the Real-Time Workshop > Interface pane.
| Parameter: EfficientMapNaN2IntZero |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | Off |
| Efficiency | On |
| Safety precaution | Off (for simulation and during development) On (for production code generation) |
Specify whether to generate code that guards against division by zero for fixed-point data.
Default: On
Does not generate code that guards against division by zero for fixed-point data. When you select this option, simulation results and results from generated code might not be in bit-for-bit agreement.
Generates code that guards against division by zero for fixed-point data.
This parameter appears only for ERT-based targets.
This parameter requires a Real-Time Workshop Embedded Coder license when generating code.
| Parameter: NoFixptDivByZeroProtection |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'on' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | Off |
Use bitsets to reduce the amount of memory required to store state configuration variables.
Default: Off
Stores state configuration variables in bitsets. Potentially reduces the amount of memory required to store the variables. Potentially requires more instructions to access state configuration, which can result in less optimal code.
Stores state configuration variables in unsigned bytes. Potentially increases the amount of memory required to store the variables. Potentially requires fewer instructions to access state configuration, which can result in more optimal code.
Selecting this check box can significantly reduce the amount of memory required to store the variables. However, it can increase the amount of memory required to store target code if the target processor does not include instructions for manipulating bitsets.
Select this check box for Stateflow charts that have a large number of sibling states at a given level of the hierarchy.
Clear this check box for Stateflow charts with a small number of sibling states at a given level of the hierarchy.
This parameter requires a Stateflow license.
| Parameter: StateBitsets |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | Off |
| Efficiency | Off |
| Safety precaution | No impact |
Use bitsets to reduce the amount of memory required to store Boolean data.
Default: Off
Stores Boolean data in bitsets. Potentially reduces the amount of memory required to store the data. Potentially requires more instructions to access the data, which can result in less optimal code.
Stores Boolean data in unsigned bytes. Potentially increases the amount of memory required to store the data. Potentially requires fewer instructions to access the data, which can result in more optimal code.
Select this check box for Stateflow charts that reference Boolean data infrequently.
Clear this check box for Stateflow charts that reference Boolean data frequently.
This parameter requires a Stateflow license.
| Parameter: DataBitsets |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | Off |
| Traceability | Off |
| Efficiency | Off |
| Safety precaution | No impact |
The Model Parameter Configuration dialog box allows you to override the Inline parameters option (see Inline parameters) for selected parameters.

Note Simulink software ignores the settings of this dialog box if a model contains references to other models. However, you can still tune parameters of such models, using Simulink.Parameter objects (see Inline Parameter Requirements for more information). |
The dialog box has the following controls.
Displays a list of workspace variables. The options are:
MATLAB workspace
Lists all variables in the MATLAB workspace that have numeric values.
Referenced workspace variables
Lists only those variables referenced by the model.
Updates the source list. Click this button if you have added a variable to the workspace since the last time the list was displayed.
Adds the variables selected in the source list to the adjacent table of tunable parameters.
Defines a new parameter and adds it to the list of tunable parameters. Use this button to create tunable parameters that are not yet defined in the MATLAB workspace.
Note This option does not create the corresponding variable in the MATLAB workspace. You must create the variable yourself. |
Used for code generation. See the Real-Time Workshop User's Guide for more information.
Used for code generation. See the Real-Time Workshop User's Guide for more information.
Sets the degree of optimization used by the compiler when generating code for acceleration.
Default: Optimizations off (faster builds)
Specifies the compiler not to optimize code. This results in faster build times.
Specifies the compiler to generate optimized code. The generated code will run faster, but the model build will take longer than if optimizations are off.
The default Optimizations off is a good choice for most models. This quickly produces code that can be used with acceleration.
Set Optimizations on to optimize your code. The fast running code produced by optimization can be advantageous if you will repeatedly run your model with the accelerator.
| Parameter: SimCompilerOptimization |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Select the amount of information displayed during code generation for Simulink Accelerator mode, referenced model Accelerator mode, and Rapid Accelerator mode.
Default: Off
Display limited amount of information during the code generation process.
Display progress information during code generation, and show the compiler options in use.
| Parameter: AccelVerboseBuild |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
For more information about AccelVerboseBuild, see Controlling Verbosity During Code Generation.
![]() | Data Import/Export Pane | Diagnostics Pane: Solver | ![]() |

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 |