Main Content

addControlVariables

Class: Simulink.VariantConfigurationData
Package: Simulink

Add control variables to an existing variant configuration

Syntax

vcdataObj.addControlVariables(nameOfConfiguration,controlVars)

Description

vcdataObj.addControlVariables(nameOfConfiguration,controlVars), adds control variables to a variant configuration.

Input Arguments

nameOfConfiguration

Specifies the name of an existing configuration.

controlVars

Control variables being added. This argument must be a vector of structures with required fields: Name and Value. The values assigned to the Name field must be unique and valid MATLAB® variable names. The Value field can contain either character vectors or Simulink.Parameter objects. The values of control variables are checked during validation of the variant configuration.

Examples

% Define the variant configuration data object
vcdataObj = Simulink.VariantConfigurationData;

% Add a variant configuration named LinInterExp
vcdataObj.addConfiguration('LinInterExp',...
'Linear Internal Experimental Plant Controller');

% Add control variables SmartSensor1Mod and PlanLocation
vcdataObj.addControlVariables('LinInterExp',...
  cell2struct({'SmartSensor1Mod', '2';...
               'PlantLocation', '1'},...
              {'Name', 'Value'}, 2))