matlab.system.getSampleTimeImpl - Specify sample time type, offset time, and sample time - MATLAB (original) (raw)
Main Content
Specify sample time type, offset time, and sample time
Syntax
sts = getSampleTimeImpl(obj)
Description
[sts](#d126e592696) = getSampleTimeImpl([obj](#mw%5F48891364-8b3b-4b54-942b-537c445f2b47%5Fsep%5Fmw%5F353aa417-3412-46f8-81f1-586adf7da5a8))
returns the sample time specification created within the method body, sts
, for the System objectâ„¢ obj
. Specify the sample time specification within the body ofgetSampleTimeImpl
by calling createSampleTime. The sample time specification affects the simulation time when the System object is included in a MATLAB System block.
Run-Time Details
getSampleTimeImpl is called during setup by setupImpl.
Method Authoring Tips
You must set Access = protected
for this method.
Default Behavior
If you do not include this method in your System object definition, the sample time is inherited.
Input Arguments
System object handle used to access properties, states, and methods specific to the object. If your getSampleTimeImpl
method does not use the object, you can replace this input with ~
.
Output Arguments
An object defining the sample time specification values. You create this object with the createSampleTime function.
Examples
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 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
Version History
Introduced in R2017b