フィルターのクリア

How to select variant within a model reference?

22 ビュー (過去 30 日間)
Chris Ewing
Chris Ewing 2024 年 4 月 2 日 11:54
編集済み: Fangjun Jiang 2024 年 4 月 3 日 11:57
I have a variant block that's within a model reference. I'd like to be able to control which variant is selected from a mask pop menu on a block that contains the model reference, but I can't figure out the proper functionality to accomplish this. If the model reference is a subsystem block instead of a model reference, then I can put code in the pop menu mask parameter's callback code to set the "LabelModeActiveChoice" on the variant block.
I have tried:
1) Using a Subsystem Reference block. This doesn't work, as I get a "Incorrect to modify Subsystem Reference block using callback code" error.
2) Piping the selection via a parameter on the model reference block and putting callback code on a initialization code of a mask on a block containing the variant block. This break because it's trying to change the variant during model init.

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2024 年 4 月 2 日 12:32
編集済み: Fangjun Jiang 2024 年 4 月 3 日 11:57
Combine this with model parameter for the model reference?
Also, note the following.
"The operands that you specify in a condition expression of type Simulink.VariantExpression must be defined in the base workspace or a data dictionary. Specifying operands that are defined in the mask or model workspace is not supported."

カテゴリ

Help Center および File ExchangeComponent-Based Modeling についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by