| Contents | Index |
Ports & Subsystems
Variant subsystems provide multiple implementations for a subsystem where only one implementation is active during simulation. You can programmatically swap out the active implementation and with another implementation without modifying the model.
The Variant Subsystem block includes multiple child subsystems, where only one subsystem runs during simulation. The Variant Subsystem block also can include Inport, Outport, and Connection Port blocks. There are no drawn connections inside the Variant Subsystem block. Each child subsystem is associated with a variant object, which is created in the base workspace. The variant object is defined with a condition to determine if it is the active subsystem.
For information on the data types accepted by a subsystem's input ports, see Inport block. For information on the data types output by a subsystem's output ports, see Outport block.
For more information, see Data Types Supported by Simulink in the Simulink documentation.

Displays a table of subsystems, variant objects, and conditions, which are Boolean expressions that determine the active variant.
Default: The table has a row for each subsystem in the Variant Subsystem block. If the Variant Subsystem block does not contain any subsystems, then the table is empty. See each column parameter for its default value:
You can use buttons to the left of the Variant choices table to modify the elements of the table.
| To... | Click... |
|---|---|
| Create and add a new subsystem choice: Places a new subsystem choice in the table and creates a new subsystem block in the Variant Subsystem block diagram. |
|
| Create/Edit selected variant object: Creates a Simulink.Variant object in the base workspace and opens the Simulink.Variant object parameter dialog box to specify the variant Condition. |
|
| Open selected subsystem variant choice: Opens the subsystem block diagram for the selected row in the Variant choices table. |
|
| Refresh dialog information from variant subsystem contents: Updates the Variant choices table according to the Subsystem block configuration and values of the variant object in the base workspace. |
|
Name of the subsystem (a subsystem contained in the Variant Subsystem block)
A read only field, based on the subsystems contained in the
Variant Subsystem block diagram. To add a new subsystem to the Variant
Subsystem block diagram, click the Create and add a new
subsystem choice button
.
Display the Simulink.Variant objects in the base workspace or enter a variant object name in a new row.
Default: Variant
To enter a variant object name, double-click a Variant object cell in a new row and type in the variant object name. Define that variant object in the base workspace.
| Structure field: Represented by the variant.Name field in the Variant parameter structure |
| Type: string |
| Value: Name of the Simulink.Variant object that represents the variant to which this element applies. |
| Default: '' |
Displays the Condition for the Simulink.Variant object.
A read-only field, based on the condition for the associated variant object in the base workspace. Create or change a variant condition in the Simulink.Variant parameter dialog box or in the base workspace.
Specify whether to designate the active variant from the evaluation of the variant conditions or from the value of the Variant parameter.
Default: Off
Override the variant conditions and set the active variant to the value of the Variant parameter
Determine the active variant by the value of the variant conditions
This parameter enables Variant.
| Parameter: OverrideUsingVariant |
| Type: string |
| Value: '' if no overriding variant object is specified, or the name of the overriding variant object |
| Default: '' |
Specify the name of the variant to use if you select Override variant conditions and use the following variant.
Default: ''
Must be a valid MATLAB identifier.
You can use the Variant drop-down list to see a list of all variant objects currently in the base workspace.
Enable variants and Override variant conditions and use the following variant enable this parameter.
| Parameter: OverrideUsingVariant |
| Type: string |
| Value: Name of the Simulink.Variant object |
Control whether generated code contains preprocessor conditionals for this Variant Subsystem block.
Default: Disabled
The check box is available for generating only ERT targets.
Override variant conditions and use following variant is cleared ('off')
Configuration Parameters > Optimization > Inline parameters is selected ('on')
Configuration Parameters > Code Generation > Interface > Generate preprocessor conditionals is set to Use local settings.
| Parameter: GeneratePreprocessorConditionals |
| Type: string |
| Value: 'off' | 'on' |
| Default: 'off' |

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