Main Content

getChoice

Return choices of variant parameter object

    Description

    example

    choices = getChoice(P) returns all the choices of variant parameter p in a cell array.

    example

    choices = getChoice(P,Condition) returns the value associated with the variant condition Condition. You can specify multiple conditions of variant parameter p in a cell array.

    Examples

    collapse all

    Create a Simulink.VariantVariable object.

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

    Get all variant choices of the object.

    choices = getChoice(p)

    Create a Simulink.VariantVariable object.

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

    Get the value associated with variant condition V==1.

    choice = getChoice(p, 'V==2')

    Input Arguments

    collapse all

    Variant parameter object created using Simulink.VariantVariable, specified as a Simulink.VariantVariable object.

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

    Example: 'V==2'

    Data Types: char

    Introduced in R2021a