How to switch between 'Connected IO' mode and 'Run in Kernel' mode programmatically when using Simulink Desktop Real-Time (SLDRT) ?
显示 更早的评论
Hi all,
Release: MATLAB 2022b Update 8
Using Simulink Desktop Real-Time, we can select two execution modes : 'Run in Kernel', or 'Connected IO' :

Switching between modes is easy enough through the Simulink menu shown above. But I would like to know if it is possible to change this option programmatically, from the MATLAB command window, or from a script?
I came upon these commands :
set_param(gcs, 'SimulationMode', 'external');
set_param(gcs, 'SimulationMode', 'normal');
However, these commands do not update the Simulink button shown above. They only take effect when running the Simulink model from the command line, using :
set_param(gcs, 'SimulationCommand', 'start');
set_param(gcs, 'SimulationCommand', 'stop');
If I run the model through the "Run in Real Time" button in the Simulink top menu, the simulation mode still corresponds to the old button state, and not to the command that was entered.
It feels like I should force the refresh of the Simulink top ribbon menu after entering the set_param(gcs, 'SimulationMode', 'external') command, so that it actually registers in the Simulink UI (top ribbon), but how to do this?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Target Computer Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!