Specify sample time type, offset time, and sample time
sts = getSampleTimeImpl(obj)
returns the sample time
specification created within the method body,
sts = getSampleTimeImpl(
sts, for the System object™
obj. Specify the sample time specification within the body of
getSampleTimeImpl by calling
createSampleTime. The sample time
specification affects the simulation time when the System object is included in a MATLAB System block.
getSampleTimeImpl is called during setup by
Method Authoring Tips
You must set
Access = protected for this method.
If you do not include this method in your System object definition, the sample time is inherited.
obj — System object
System object handle used to access properties, states, and methods specific to the object. If
getSampleTimeImpl method does not use the object, you can replace this
sts — Sample time specification object
sample time specification object
An object defining the sample time specification values. You create this
object with the
Specify Inherited Sample Time
Specify that the MATLAB System block should inherit the sample from upstream blocks, except if the sample time type is controllable.
function sts = getSampleTimeImpl(obj) sts = createSampleTime(obj,'ErrorOnPropagation','Controllable'); end
Specify Discrete Sample Time
Specify a discrete sample time for the MATLAB System block.
function sts = getSampleTimeImpl(obj) sts = createSampleTime(obj,'Type','Discrete',... 'SampleTime',10.2,'OffsetTime',0.5); end
Introduced in R2017b