Main Content

addSubModelConfigurations

(To be removed) Add to a variant configuration the names of the configurations to be used for referenced models

    addSubModelConfigurations will be removed in a future release. Use addComponentConfiguration instead. (since R2022b) For information on updating your code, see Version History.

    Description

    addSubModelConfigurations(varconfigdata,configName,subModelConfigs) associates a variant configuration in varconfigdata with the configurations that must be used for referenced models. varconfigdata is a Simulink.VariantConfigurationData object and represents the variant configuration object of the parent model. subModelConfigs specifies names of the variant configurations to be used for referenced models.

    example

    Examples

    collapse all

    Add the path to the model file.

    addpath(fullfile...
    (matlabroot,'examples','simulink_variants','main'));

    Load the model.

    load_system('slexVariantManagement');

    Obtain variant configuration data object for the model.

    vcdataObj = Simulink.VariantConfigurationData.getFor...
     ('slexVariantManagement');
    

    Add a new submodel configuration to LinInterExpNoNoise.

    addSubModelConfigurations(vcdataObj,'LinInterExpNoNoise',...
      [struct('ModelName', 'slexVariantManagementExternalPlantMdlRef',...
              'ConfigurationName', 'LowFid')])

    Input Arguments

    collapse all

    Variant configuration data object in which the top-level configuration configName is defined, specified as a Simulink.VariantConfigurationData object.

    Name of variant configuration of top level model, specified as a character vector or string.

    Example: "LinInterExpNoNoise"

    Data Types: char | string

    Vector of structures containing fields: ModelName, ConfigurationName. The names of referenced models must be unique and valid MATLAB® variable names and configuration names must be valid MATLAB variables.

    Example: [struct('ModelName','slexVariantManagementExternalPlantMdlRef','ConfigurationName','LowFid')]

    Data Types: struct

    Version History

    Introduced in R2013b

    collapse all