Guy on Simulink

Simulink & Model-Based Design

Running a Simulation Step by Step 7

Posted by Guy Rouleau,

As you probably know, when you simulate a model, there is a lot of stuff going on that you do not see.

Yesterday I showed a user how to visualize the execution of a simulation step by step using the Simulink Debugger and he was very impressed. Let's take a look at the debugger animation.

Simulink Debugger Animation

If you are interested in seeing every method executed by the Simulink engine during the simulation, start the Simulink Debugger from the Tools menu. Then click on the Animation Mode button and start your simulation.

Simulink debugger in action

What are all those methods?

The documentation for the Debug Pointer gives a description of the rectangular patches displayed on the blocks and the meaning of their color.

Debug Pointer

If you are interested to learn more about all those steps taken by the Simulink engine, I recommend going through the documentation page How the Simulink Engine Interacts with C S-Functions.

This documentation will show you in which order those methods are executing and you will find a link describing each of them. S-functions provide all the methods used by Simulink to simulate a model, so if you understand how S-functions work, you will understand how Simulink works.

What's Next?

What I showed today is only one of the many feature of the Simulink Debugger. If you are interested in learning more about what the Simulink Debugger can do for you, let me know by leaving a comment here.

Now it's your turn

Now you can cancel your cabel/satelite subscription! Open your favorite model, get a cold beer, some snacks, and sit back to enjoy the Simulink Debugger Animation! (Can you tell it is Friday?)

7 CommentsOldest to Newest

Eike Petersen replied on : 1 of 7

Would be nice if you could show some more features of the debugger. I think there are lots of people (including me) who have no idea about what you can do with it.

Kind Regards,


Thomas Marullo replied on : 2 of 7

I also would like to see a much more detailed usage of tracing through a model to debug specific outputs.

Abhishek replied on : 3 of 7

I agree with the above comments. A long video giving detailed explanation with examples of debugging will help out hundreds of frustrated grad students (like me).

Nathan Fitzgerald replied on : 4 of 7

Did the debugger change in 2012b? It looks like it’s now located under Simulation->Debug->Debug Model, but I don’t see the animate buttons anywhere on the debugger window.

Guy Rouleau replied on : 5 of 7

@Nathan: You are correct. In R2012b, the animation is not available in the Simulink debugger. If find this very infortunate, but we are looking on something better for a future release.

About incompatibilities of the Simulink debugger, the Simulink R2012b release notes mention the following:

The following capabilities are not available in the debugger:

– Animations
– Adding breakpoints while in the initialization phase
– Displaying I/O while in the initialization phase

Florian Tschopp replied on : 6 of 7

Using MATLAB/Simulink R2015a is this still not possible any more? Is there any similar measure to perform a “step-by-step” simulation?

Guy Rouleau replied on : 7 of 7

Florian, Since R2012b the debugger has changed. It is still possible to use it to go step by step through all the blocks method. However the Animation, with the arrow pointing to the blocks and the colored rectangles are gone.

One great feature that appeared in R2012b is the simulation stepper, which allows you to by one time step at a time. You can find more info here:

Add A Comment

Your email address will not be published. Required fields are marked *


Preview: hide