Main Content


Display and provide simulation time

  • Clock block

Simulink / Sources


The Clock block outputs the current simulation time at each simulation step. This block is useful for other blocks that need the simulation time.

When you need the current time within a discrete system, use the Digital Clock block.


expand all

This example shows how to use the Memory and Clock blocks to calculate and display the step size in a simulation. The Sum block subtracts the time at the previous time step, which the Memory block generates, from the current time, which the Clock block generates.

Because Inherit sample time is not selected for the Memory block, the block sample time depends on the type of solver for simulating the model. In this case, the model uses a fixed-step solver. Therefore, the sample time of the Memory block is the solver step size, or 1.

If you replace the Memory block with a Unit Delay block, you get the same results. The Unit Delay block inherits a discrete sample time of 1.



expand all

Sample time, specified as the current simulation time at each simulation time step.

Data Types: double


expand all

Select this check box to display the simulation time as part of the Clock block icon. When you clear this check box, the simulation time does not appear on the block icon.

Programmatic Use

Block Parameter: DisplayTime
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Specify the interval at which Simulink® updates the Clock icon as a positive integer.

Suppose that the decimation is 1000. For a fixed integration step of 1 millisecond, the Clock icon updates at 1 second, 2 seconds, and so on.


To display the simulation time on the block icon, you must select the Display time check box.

Programmatic Use

Block Parameter: Decimation
Type: character vector
Value: scalar
Default: '10'

Block Characteristics

Data Types


Direct Feedthrough


Multidimensional Signals


Variable-Size Signals


Zero-Crossing Detection


Extended Capabilities

Version History

Introduced before R2006a