How to run a Simulink Desktop Real-Time model with external mode in an App Designer app?

2 ビュー (過去 30 日間)
xiaofu zhang
xiaofu zhang 2022 年 6 月 7 日
回答済み: Hyunuk Ha 2023 年 4 月 29 日
I need to create an app that runs a Simulink Desktop Real-Time model in the external mode, like this
In the MATLAB app, I set up a button callback function to start my simulation, like this
set_param(MyModel,'SimulationCommand','start')
But I noticed that the simulink model seems to work in the Nomal mode, shown as
What should I do or set parameters to make the model run in external mode in my designed app.
Any information will be helpful and thanks in advance.

回答 (1 件)

Hyunuk Ha
Hyunuk Ha 2023 年 4 月 29 日
You can utilize 'slrealtime' .
Like,
>> tg = slrealtime;
>> tg.start();
The brief workflows are,
  1. Build model
>> rtwbuild('mdl'); % or slbuild('mdl');
This generates mdl.mdlatx file.
2. Load model
>> tg.load('mdl')
3. start model
>> tg.start();
You can easily utilize using 'slrealtime' obj.

カテゴリ

Help Center および File ExchangeReal-Time Simulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by