Documentation Center

  • Trial Software
  • Product Updates

Contents

ssGetDiscStates

Get a block's discrete states

Syntax

real_T *ssGetDiscStates(SimStruct *S)

Arguments

S

SimStruct representing an S-Function block.

Returns

A pointer (real_T *) to the discrete state vector as an array of length ssGetNumDiscStates(S). Returns NULL if the S-function does not have any discrete states.

Description

Use to obtain the block's discrete states. Typically, the state vector is initialized in mdlInitializeConditions, updated in mdlUpdate, and used in mdlOutputs. You can use this macro in the simulation loop, mdlInitializeConditions, or mdlStart routines.

Languages

C, C++

Example

See the S-function dsfunc.cdsfunc.c used in sfcndemo_dsfuncsfcndemo_dsfunc for an example on how to initialize and update the discrete state vector.

Was this topic helpful?