Clear Filters
Clear Filters

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

3 views (last 30 days)
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?

Answers (1)

Imran
Imran on 2 Jan 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.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!