setChoice - Modify existing choices of variant parameter object - MATLAB (original) (raw)

Modify existing choices of variant parameter object

Since R2021a

Syntax

Description

P = setChoice([P](#mw%5Fec15c166-6a86-4b5a-b36a-34916145bc64),Choices{[Condition,Value](#mw%5F7186aae6-c232-4cdb-9221-0f1f1a261107%5Fsep%5Fmw%5Fc0c802b6-774a-4296-893a-0a9ae2ad689b)}) replaces the value associated with the variant condition Condition by the new value Value. You can modify multiple values of variant variableP by specifying condition-value pairs in a cell array. If the choice corresponding to the specified condition already exists, the associated value is overridden. Otherwise, a new choice is added.

example

Examples

collapse all

Create a Simulink.VariantVariable object.

P = Simulink.VariantVariable('Choices',{'V==1',8,'V==2',9})

Modify a variant choice associated with the variant conditionV==1.

P = setChoice(P, {'V==1', 3.5});

Create a Simulink.VariantVariable object.

P = Simulink.VariantVariable('Choices',{'V==1',8,'V==2',9,'V==3',12})

Modify variant choices associated with variant conditions V==1 and V==3.

P = setChoice(P, {'V==1', 3.5,'V==3',20});

Input Arguments

collapse all

Variant parameter object created using [Simulink.VariantVariable](simulink.variantvariable-class.html), specified as a Simulink.VariantVariable object. This object is updated with the new values that you specify using setChoice.

Version History

Introduced in R2021a