Main Content

removeChoice

Remove choices from variant parameter object

    Description

    example

    P = removeChoice(P,Condition) removes the condition-value pair from variant variable P corresponding to condition Condition. You can remove multiple choices from P by specifying conditions in a cell array. Specifying variant conditions that do not exist results in an error.

    Examples

    collapse all

    Create a Simulink.VariantVariable object.

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

    Remove the variant choice associated with condition V==2.

    P = removeChoice(P,'V==2');
    

    Create a Simulink.VariantVariable object.

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

    Remove variant choices associated with conditions V==2 and V==3.

    P = removeChoice(P, {'V==2','V==3'});
    

    Input Arguments

    collapse all

    Variant parameter object created using Simulink.VariantVariable, specified as an Simulink.VariantVariable object. The choices that you specify using removeChoice are removed from this object.

    Variant control expression corresponding to the value to be removed, specified as a string. You can remove multiple choices from the object by specifying conditions in a cell array.

    Example: 'V==2'

    Data Types: char

    Introduced in R2021a