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.


Get the mode vector


int_T *ssGetModeVector(SimStruct *S)



SimStruct representing an S-Function block.


A pointer (int_T *) to the mode vector.


Use to obtain a pointer to the mode vector. This vector has length ssGetNumModes(S). Typically, this vector is initialized in mdlInitializeConditions if the default value of 0 isn't acceptable. It is then used in mdlOutputs, in conjunction with nonsampled zero crossings, to determine when the output function should change mode. For example, consider an absolute value function. When the input is negative, negate it to create a positive value; otherwise, take no action. This function has two modes. The output function should be designed not to change modes during minor time steps. You can also use the mode vector in the mdlZeroCrossings routine to determine the current mode.


C, C++


See the S-function sfun_zc.c used in sfcndemo_sfun_zc.

Introduced before R2006a

Was this topic helpful?