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.


Specify the number of discrete states that a block has


void ssSetNumDiscStates(SimStruct *S, int_T nDiscStates)



SimStruct representing an S-Function block.


Number of discrete states to be set for the block represented by S.


Use in mdlInitializeSizes to specify the number of discrete states as 0, a positive integer, or DYNAMICALLY_SIZED. If you specify DYNAMICALLY_SIZED, you can specify the true (positive integer) width in mdlSetWorkWidths; otherwise, the width used is the width of the signal passing through the block. If your S-function has discrete states, it should return the next discrete state (in place) in mdlUpdate. Discrete states are logged if the States option is selected on the Data Import/Export page of the Configuration Parameters dialog box.


C, C++


See the S-function dsfunc.c used in sfcndemo_dsfunc.

Introduced before R2006a

Was this topic helpful?