Why does Simulink pauses execution on pause command in Matlab-app?

1 visualizzazione (ultimi 30 giorni)
I have the problem that Simulink pauses when I call the model in an app (with App Designer) and then use the pause or waitfor command in that app. For this period of time the model continues to run, but the simulation time does not continue.
...
load_system('model');
set_param('model','SimulationCommand','Start');
...
pause(10);
...
Does anyone have any idea how to work around this?

Risposte (1)

Imran
Imran il 2 Gen 2023
Hello Paul,
I understand that when you use the 'pause' command in your app in app designer, model continues to run, but the simulation time stops.
The 'pause' command only causes the MATLAB commands and scripts to pause, not the model simulation.
While MATLAB is paused, the following continue to execute:
  • Repainting of figure windows, Simulink block diagrams, and Java® windows.
  • Call-backs from figure windows.
  • Event handling from Java windows.
The way to pause a simulation is by using the following command
set_param('<modelname>','SimulationCommand','pause')
In your case, as the model’s name is 'model', you should replace the pause command with the following command
set_param('model','SimulationCommand','pause')
I hope this would help.

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by