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 that a data type work vector is used as a discrete state vector


int_T ssSetDWorkUsedAsDState(SimStruct *S, int_T vector,
  int_T usage)



SimStruct representing an S-Function block.


Index of a data type work vector, where the index is one of 0, 1, 2, ... ssGetNumDWork(S)-1.


How this vector is used. A value of 1 indicates that the work vector is to be used to store the block's discrete states (SS_DWORK_USED_AS_DSTATE), a value of 0 indicates that the work vector is to be used as a work vector (SS_DWORK_USED_AS_DWORK).


0 if usage is SS_DWORK_USED_AS_DWORK (0), otherwise returns 1.


Use in mdlInitializeSizes or mdlSetWorkWidths to specify if the DWork vector vector is used to store the block's discrete states, SS_DWORK_USED_AS_DSTATE (1), or not, SS_DWORK_USED_AS_DWORK (0), the default.

    Note   Specify the usage as SS_DWORK_USED_AS_DSTATE if the following conditions are true. You want to use the vector to store discrete states and you want the Simulink® engine to log the discrete states to the workspace at the end of a simulation, if the user has selected the Save to Workspace options on the Data Import/Export pane of the Configuration Parameters dialog box.


C, C++


For more information on using DWork vectors, see How to Use DWork Vectors.

Introduced before R2006a

Was this topic helpful?