getChoice - Return choices of variant parameter object - MATLAB (original) (raw)
Main Content
Return choices of variant parameter object
Since R2021a
Syntax
Description
choices = getChoice([P](#mw%5F8bcb51bf-b5da-40b0-a1b5-edffb9252847))
returns all the choices of variant parameter p
in a cell array.
choices = getChoice([P](#mw%5F8bcb51bf-b5da-40b0-a1b5-edffb9252847),[Condition](#mw%5F370bf28d-0ec7-4236-bcb5-04a515bb8d71))
returns the value associated with the variant condition Condition
. You can specify multiple conditions of variant parameter p
in a cell array.
Examples
Create a Simulink.VariantVariable
object.
p = Simulink.VariantVariable('Choices',{'V==1',8,'V==2',9})
Get all variant choices of the object.
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
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
Version History
Introduced in R2021a