matlab.system.mixin.SampleTime class

Control sample time for System objects in Simulink


matlab.system.mixin.SampleTime specifies the sample time specifications for a System object™ when it is included in a MATLAB System block. Inherit from this mixin class and its methods to control the sample time of your System object in Simulink®, via the MATLAB System block.

With this mixin, you can:

  • Specify the sample time type

  • Specify the sample time

  • Customize the sample time with offsets and tick times

  • Get the current simulation time

System objects that inherit from this mixin class must also inherit from matlab.System. For example:

classdef MySystemObject < matlab.System & matlab.system.mixin.SampleTime


createSampleTimeCreate sample time specification object
getCurrentTimeCurrent simulation time in MATLAB System block
getSampleTimeQuery sample time
getSampleTimeImplSpecify sample time type, offset time, and sample time
setNumTicksUntilNextHitSet the number of ticks in Simulink sample time

Introduced in R2017b