MATLAB 帮助中心
本页采用了机器翻译。点击此处可查看最新英文版本。
获取变体组件的活动选择项
choice = getActiveChoice(variantComponent)
choice = getActiveChoice(variantComponent) 查找变体组件的活动选择项。
choice
variantComponent
示例
全部折叠
创建一个模型,获取根架构,创建一个变体组件,为变体组件添加两个选择项,设置活动选择项,并获取活动选择项。
model = systemcomposer.createModel("archModel"); systemcomposer.openModel("archModel"); arch = get(model,"Architecture"); variant = addVariantComponent(arch,"Component1"); compList = addChoice(variant,["Choice1","Choice2"]); setActiveChoice(variant,compList(2)); comp = getActiveChoice(variant)
comp = Component with properties: IsAdapterComponent: 0 Architecture: [1×1 systemcomposer.arch.Architecture] Name: 'Choice2' Parent: [1×1 systemcomposer.arch.Architecture] Ports: [0×0 systemcomposer.arch.ComponentPort] OwnedPorts: [0×0 systemcomposer.arch.ComponentPort] OwnedArchitecture: [1×1 systemcomposer.arch.Architecture] Parameters: [0×0 systemcomposer.arch.Parameter] Position: [15 15 65 76] Model: [1×1 systemcomposer.arch.Model] SimulinkHandle: 221.0005 SimulinkModelHandle: 153.0002 UUID: '8d71e26a-eabf-4ab2-a0e0-3d06ef0111c0' ExternalUID: ''
变体组件,指定为 systemcomposer.arch.VariantComponent 对象。
systemcomposer.arch.VariantComponent
选择的变体,以 systemcomposer.arch.Component 对象的形式返回。
systemcomposer.arch.Component
变体是变体组件中众多结构或行为选择项之一。
在执行分析时,使用变体可快速切换组件的不同架构设计。
变体控制项是控制活动变体选择项的字符串。
以编程方式设置变体控制项,以控制哪个变体处于活动状态。
在 R2019a 中推出
addChoice
addVariantComponent
getChoices
getCondition
makeVariant
makeVariantAssembly
setActiveChoice
setCondition
updatePortsFromChoices
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处