Contenuto principale

addSubModelConfigurations

R2026b

(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 addReferencedConfiguration 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.VariantConfigurations object and represents the variant configurations 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 configurations object for the model.

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

    Add a new submodel configuration to LinInterExpNoNoise.

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

    Input Arguments

    collapse all

    Variant configurations object in which the top-level configuration configName is defined, specified as a Simulink.VariantConfigurations 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

    expand all