Main Content

getVariantConfiguration

Get name of variant configuration from SimulationInput object

Since R2024a

Description

varconfigname = getVariantConfiguration(simin) returns the name of the variant configuration set in the Simulink.SimulationInput object simin.

example

Examples

collapse all

Get the name of the variant configuration that was set in the SimulationInput object using the setVariantConfiguration function.

Open the model.

openExample("simulink_variants/RunMultipleSimulationsUsingVariantConfigurationsExample")
modelName = "slexVariantReducer";
open_system(modelName);

Create a SimulationInput object for this model and set the variant configuration to apply before the simulation runs.

simin = Simulink.SimulationInput(modelName);
simin = setVariantConfiguration(simin,'config1');

Get the name of the variant configuration from the SimulationInput object.

varconfigname = getVariantConfiguration(simin)
varconfigname =

    'config1'

When you set multiple variant configurations in an array of SimulationInput objects, the getVariantConfiguration function returns the configurations as a cell array of character vectors.

siminputs(1:2) = Simulink.SimulationInput(modelName);
siminputs = setVariantConfiguration(siminputs,{'config1','config2'});
varconfignames = getVariantConfiguration(siminputs)
varconfignames =

  1×2 cell array

    {'config1'}    {'config2'}

Input Arguments

collapse all

Simulation specification from which to get the variant configuration name, specified as a Simulink.SimulationInput object or an array of Simulink.SimulationInput objects.

Example: varconfigname = getVariantConfiguration(simin) gets the name of the variant configuration from the simulation configuration stored in the SimulationInput object simin.

Output Arguments

collapse all

Name of variant configuration set in the SimulationInput object simin, returned as a character vector or cell array of character vectors.

Version History

Introduced in R2024a