setCondition - Set condition on variant choice - MATLAB (original) (raw)
Main Content
Set condition on variant choice
Syntax
Description
setCondition([variantComponent](#mw%5F00e466e6-b7f6-4763-acb4-464146be553c%5Fsep%5Fmw%5Fdc134891-6ed2-4ed7-8511-0d8e13eb5044),[choice](#mw%5F00e466e6-b7f6-4763-acb4-464146be553c%5Fsep%5Fmw%5F3cf5ef70-6110-4994-b4a3-c72fc6428bdf),[expression](#mw%5Fb87c5c62-d36b-4f48-944f-9dd587ae05a3))
sets the variant control condition specified by expression
for the choice choice
on the variant componentvariantComponent
to choose the active variant choice. If the condition is met on a variant choice, that variant choice becomes the active choice on the variant component.
Examples
Create a model, get the root architecture, create one variant component, add two choices for the variant component, and set a condition on one variant choice to choose the active variant choice.
model = systemcomposer.createModel("archModel"); systemcomposer.openModel("archModel"); arch = get(model,"Architecture"); mode = 1; variant = addVariantComponent(arch,"Component1"); compList = addChoice(variant,["Choice1","Choice2"]); setCondition(variant,compList(2),"mode == 2");
Input Arguments
Control string that controls the selection of choice, specified as a character vector or string.
Data Types: char
| string
More About
Term | Definition | Application | More Information |
---|---|---|---|
Variant | A variant is one of many structural or behavioral choices in a variant component. | Use variants to quickly swap different architectural designs for a component while performing analysis. | Create Variants |
Variant control | A variant control is a string that controls the active variant choice. | Set the variant control programmatically to control which variant is active. | Set Variant Control Condition |
Version History
Introduced in R2019a
See Also
Blocks
Objects
Functions
- addChoice | addVariantComponent | getActiveChoice | getChoices | getCondition | makeVariant | makeVariantAssembly | setActiveChoice | updatePortsFromChoices