Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

ssIsSpecialSampleHit

Determine whether the sample time is hit

Syntax

boolean_T ssIsSpecialSampleHit(SimStruct *S, int_T sti1,
 int_T sti2, int_T tid)

Arguments

S

SimStruct representing an S-Function block.

sti1

Index of the sample time.

sti2

Index of the sample time.

tid

Task ID.

Returns

The Boolean value true if a sample hit has occurred at sti1 and a sample hit has also occurred at sti2 in the same time step. Otherwise, returns false.

Description

Use this macro in mdlUpdate and mdlOutputs to ensure the validity of data shared by multiple tasks running at different rates. For more information, see Synchronizing Multirate S-Function Blocks.

When using the ssIsSpecialSampleHit macro, the slower sample time must be an integer multiple of the faster sample time.

Languages

C, C++

Example

See the S-function mixedm.c used in sfcndemo_mixedm and the S-function sfun_multirate.c used in sfcndemo_sfun_multirate.

Introduced before R2006a

Was this topic helpful?