Main Content

ssGetPWorkValue

Get a pointer from a block's pointer work vector

Syntax

void *ssGetPWorkValue(SimStruct *S, int_T idx)

Arguments

S

SimStruct that represents an S-Function block.

idx

Index of the pointer returned by this function.

Returns

The (void *) element of the PWork vector at the index idx.

Description

Use to access an element of the pointer work vector used by the block represented by S. The vector consists of elements of type void * and is of length ssGetNumPWork(S). Typically, this vector is initialized in mdlStart or mdlInitializeConditions, updated in mdlUpdate, and used in mdlOutputs. You can use this macro in the simulation loop, mdlInitializeConditions, or mdlStart routines. A return value of NULL indicates that no value was assigned into the idx element of the pointer work vector.

Languages

C, C++

Examples

The following statement

void* v = ssGetPWorkValue(S, 0);

is equivalent to

void** wv = ssGetPWork(S);
void* v = wv[0];

Version History

Introduced before R2006a