Main Content

Simulink.VariantUtils.variantLegend

Class: Simulink.VariantUtils
Namespace: Simulink

Display or control behavior of variant condition legend

Since R2023b

Description

example

Simulink.VariantUtils.variantLegend(modelName,action) displays or performs a specified action on the variant condition legend.

Simulink.VariantUtils.variantLegend(modelName,showCodeConditions=codeConditionVisibility) displays or hides the code generation condition column in the variant condition legend.

Input Arguments

expand all

Model for which the variant legend is displayed, specified as a character vector or a string.

Task to be performed on the variant condition legend for the model, specified as:

  • 'open' — Display the variant condition legend for a model. The model must be open. If the legend is opened for the first time, the model is updated.

  • 'print' — Print the data in the variant condition legend. The legend must be open. There is no preview before printing the legend.

  • 'close' — Close the variant condition legend belonging to the specified model.

Display or hide code generation condition column in the Variant Conditions Legend dialog box, specified as on or off. This column shows the variant condition in the generated code. The legend must be open for this setting to work.

Example: showCodeConditions='on'

Examples

expand all

Open the sldemo_variant_subsystems model.

model = 'slexVariantSubsystems';
open_system(model);
VSS_LINEAR_CONTROLLER = 
  VariantExpression with properties:

    Condition: 'VSS_MODE==1'

VSS_NONLINEAR_CONTROLLER = 
  VariantExpression with properties:

    Condition: 'VSS_MODE==2'

VSS_MODE = 2

Display the variant condition legend for the model.

Simulink.VariantUtils.variantLegend(model,'open');

Display the code generation conditions column in the variant condition legend.

Simulink.VariantUtils.variantLegend(model,showCodeConditions='on');

Version History

Introduced in R2023b

expand all