Skip to Main Content Skip to Search
Product Documentation

ssGetModeVector - Get the mode vector

Syntax

int_T *ssGetModeVector(SimStruct *S)

Arguments

S

SimStruct representing an S-Function block.

Returns

A pointer (int_T *) to the mode vector.

Description

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.

Languages

C, C++

Example

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

See Also

ssSetNumModes

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS