Problem changing Model Reference from GUI

2 ビュー (過去 30 日間)
Fabian Jonsson
Fabian Jonsson 2015 年 3 月 9 日
編集済み: Fabian Jonsson 2015 年 3 月 11 日
I launch a model from a GUI, and depending on what options are selected in the GUI, some model references should change. Currently, the model reference is set to have the following two variants:
CoolSys1 name 1
CoolSys2 name 2
I then add the following in a button push callback in the gui
CoolSys1 = Simulink.Variant('cs_Version==0');
CoolSys2 = Simulink.Variant('cs_Version==1');
cs_Version = get(handles.ShutterEnabled,'Value'));
I have also tried to add the Simulink.Variants to the handles of the GUI, to the model workspace and to the base workspace, but wherever I place them the model won't run and I get the following error:
Caused by:
Error using run_batchGUI (line 126)
The variant 'CoolSys1' of the variant block '.../Referenced Model (CoolSys)' must be the name of a Simulink.Variant object in the base workspace.
Error using run_batchGUI (line 126)
The variant 'CoolSys2' of the variant block '.../Referenced Model (CoolSys)' must be the name of a Simulink.Variant object in the base workspace.
Error while evaluating uicontrol Callback
I repeat, I get that error even when I DO have CoolSys1 and CoolSys2 in the model's and the base workpaces.
What can I do about this?

回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by