How to get the current simulation time in Simulink

In order to get a block that outputs the current simulation time in Simulink, you can use the built-in Clock block. This block is part of the Simulink library and provides the current simulation time as its output.

To find it, just open the Simulink Library Browser (or click on an empty area in your model) and search for Clock:

Simulink Clock simulation time

The clock will output the current simulation time in seconds as a floating-point number.

You can connect this output to other blocks in your model to use the simulation time for various purposes, such as triggering events, logging data, or performing calculations based on the elapsed time.

Example connection

Simulink clock usage example