Main Content

Simulink.VariantManager.updateModel

Obtain model compilation information and activate variant blocks in model hierarchy

Since R2024b

    Description

    The Simulink.VariantManager.updateModel function updates the given model, obtains model compilation information, and then validates and activates a variant configuration on the model and any referenced components in the model hierarchy. You can update and activate a named variant configuration defined for the model or the workspace configuration (a temporary configuration based on the current control variable values in the data sources used by the model). Variant Manager uses this compilation information until the model is updated again either by using Simulink.VariantManager.updateModel or from the Variant Manager user interface. Model compilation information enables Variant Manager to produce more accurate results for operations such as importing control variables to a configuration, activation, and identifying variant parameters used by the model hierarchy.

    For more information, see Obtain and Use Model Compilation Information in Variant Manager.

    Simulink.VariantManager.updateModel(modelName) updates the model and then activates the workspace variant configuration on the model hierarchy.

    example

    Simulink.VariantManager.updateModel(modelName,Configuration=configName) updates the model and then activates the specified named variant configuration configName on the model hierarchy.

    Note

    To use this function, you must install the Variant Manager for Simulink® support package.

    example

    Examples

    collapse all

    Obtain model compilation information and activate a variant configuration on the model programmatically.

    Open the model slexVariantManagement.

    open_system("slexVariantManagement");

    Update the model and activate the model hierarchy with the variant control variables and their values currently defined in the data sources used by the model.

    Simulink.VariantManager.updateModel("slexVariantManagement");

    Update the model and activate the model hierarchy with the variant configuration LinInterExpNoNoise defined in the variant configuration data object vcd associated with the model.

    Simulink.VariantManager.updateModel ...
    ("slexVariantManagement",Configuration="LinInterExpNoNoise");

    Input Arguments

    collapse all

    Name of the model, specified as a character vector or string.

    Example: "slexVariantManagement"

    Data Types: char | string

    Name of the variant configuration to be used to activate the model hierarchy, specified as a character vector or string. This configuration must be present in the variant configuration data object associated with modelName.

    Example: "LinInterExpNoNoise"

    Data Types: char | string

    Alternative Functionality

    You can obtain model compilation information from the Variant Manager user interface. See Obtain and Use Model Compilation Information in Variant Manager.

    Version History

    Introduced in R2024b