Documentation

Sample Time

Configure sample time for S-Function blocks

S-Function Callback Methods

mdlInitializeSampleTimesSpecify the sample rates at which this C MEX S-function operates
mdlInitializeSizesSpecify the number of inputs, outputs, states, parameters, and other characteristics of the C MEX S-function
mdlSetInputPortSampleTimeSet the sample time of an input port that inherits its sample time from the port to which it is connected
mdlSetOutputPortSampleTimeSet the sample time of an output port that inherits its sample time from the port to which it is connected

SimStruct Functions

ssSetSampleTimeSet the period of a sample time
ssSetInputPortSampleTimeSpecify the sample time of an input port
ssSetModelReferenceSampleTimeDefaultInheritanceSpecify that a referenced model containing this S-function can inherit its sample time from its parent model
ssSetModelReferenceSampleTimeDisallowInheritanceSpecify that the use of this S-function in a referenced model prevents the referenced model from inheriting its sample time from its parent model
ssSetModelReferenceSampleTimeInheritanceRuleSpecify whether use of this S-function in a referenced model prevents the referenced model from inheriting its sample time from its parent model
ssSetNumSampleTimesSpecify the number of sample times that an S-Function block has
ssSetOffsetTimeSet the offset time of a block
ssSetTNextSet the time of the next sample hit
ssSetVariableDiscreteSampleTimeRegister variable discrete sample time in a block
ssSetNumTickstoNextHitForVariableDiscreteSchedule number of steps to next event
ssGetInputPortSampleTimeGet the sample time of an input port
ssGetInputPortSampleTimeIndexGet the sample time index of an input port
ssGetNumSampleTimesGet the number of sample times that a block has
ssGetOffsetTimeGet one of an S-function's sample time offsets.
ssGetOutputPortSampleTimeGet the sample time of an output port
ssGetOutputPortSampleTimeIndexGet sample time index of output port
ssGetPortBasedSampleTimeBlockIsTriggeredDetermine whether a block that uses port-based sample times resides in a triggered subsystem
ssGetSampleTimeGet one of an S-function's sample times.
ssGetTNextGet the time of the next sample hit
ssSetParameterTuningComplianceSpecify sample time behavior and tunability for S-function blocks with port-based sample times
ssGetParameterTuningComplianceGet the sample time behavior and tunability for S-function blocks with port-based sample times
ssIsContinuousTaskDetermine whether a task is continuous
ssIsSampleHitDetermine whether the sample time is hit
ssIsSpecialSampleHitDetermine whether the sample time is hit
ssSampleAndOffsetAreTriggeredDetermine whether a sample time and offset value pair indicate a triggered sample time
ssSampleAndOffsetAreTriggeredOrAsyncDetermine whether a sample time and offset value pair indicate a triggered or asynchronous sample time

Examples and How To

Sample Times

How to specify the rate or rates at which your block operates.

Concepts

S-Function Callback Methods

Description of S-function callback methods

S-Function SimStruct Functions

Overview of SimStruct macros and functions.

Was this topic helpful?