File Exchange

image thumbnail

Minor Time Step Logging

version (45.5 KB) by Guy Rouleau
Demonstration showing how to log data computed by the Simulink® solver at minor time steps.


Updated 01 Sep 2016

View Version History

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

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.

Cite As

Guy Rouleau (2021). Minor Time Step Logging (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)

David Balbuena

Monika Jaskolka

The example model SimpleBound.mdl has an unresolved library link. Instead of 'tstbxlib/Minor Time Step Logging Library/Minor and Major Time Step Logging', it should be 'MinorStepLib/Minor and Major Time Step Logging'.

I tried using this block with a simple For Iterator in order to view the idx output at minor time steps, but received the error:

"Error evaluating registered method 'Terminate' of MATLAB S-Function 'LogMinorTimeStep' in 'test/For Iterator Subsystem/Minor and Major Time Step Logging'. The following is the MATLAB call stack (file names and line numbers) that produced this error:
['D:\Dev\MinorTimeStepLogging\LogMinorTimeStep.m'] [62]
Caused by:
Index in position 2 exceeds array bounds."

John B

Invaluable for working with continuous-time models


Henry Zhao


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.

Ingo Tammer

Maxime Journot

Very useful post !!

Will Campbell

Walid maghroum

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!