Main Content

ssSetDWorkUsedAsDState

Specify that a Dwork vector is used as a discrete state vector

Syntax

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

Arguments

S

SimStruct representing an S-Function block.

vector

Index of a Dwork vector, where the index is one of0,1,2,...ssGetNumDWork(S)-1.

使用

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

Returns

0if usage isSS_DWORK_USED_AS_DWORK(0), otherwise returns1.

Description

Use inmdlInitializeSizesormdlSetWorkWidthsto specify if the DWork vectorvectoris 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

使用指定为SS_DWORK_USED_AS_DSTATEif 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 theSave to Workspaceoptions on theData Import/Exportpane of the Configuration Parameters dialog box.

Languages

C, C++

Examples

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

Introduced before R2006a