Problem changing Model Reference from GUI

조회 수: 10 (최근 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 CenterFile Exchange에서 Component-Based Modeling에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by