How to switch between 'Connected IO' mode and 'Run in Kernel' mode programmatically when using Simulink Desktop Real-Time (SLDRT) ?
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Target Computer Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!