This submission is an example showing how a Level 2 M-file S-function can be used to help debugging models and vizualize the values computed by the Simulink® solver at minor time steps.
This submission contains a Level-2 M-file S-function that logs the minor time step data of a signal into the MATLAB® workspace and displays it in a figure at the end of the simulation.
The block is in a library and includes an slblocks.m file. Just place it on your MATLAB path and you should see it appear in the Simulink Library Browser. One example model is also included to demonstrate typical usage.
Invaluable for working with continuous-time models
This submission is excellent. I appreciate your efforts. The minor time step recording enabled me to find a bug that has been haunting me for about a week. Please keep this submission updated for current and future Matlab/Simulink releases.
Very useful post !!
added model screenshots
Updated example model.
- Fixed bug with legend labels
Create scripts with code, output, and formatted text in a single executable document.