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.


Get a pointer from a block's pointer work vector


void *ssGetPWorkValue(SimStruct *S, int_T idx)



SimStruct representing an S-Function block.


Index of the pointer returned by this function.


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


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.


C, C++


The following statement

void* v = ssGetPWorkValue(S, 0);

is equivalent to

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

Introduced before R2006a

Was this topic helpful?