ssSetPWorkValue
Set an element of a block's pointer work vector
Syntax
void *ssSetPWorkValue(SimStruct *S, int_T idx, void *pointer)
Arguments
SSimStruct that represents an S-Function block.
idxIndex of the element to be set.
pointerNew pointer element.
Returns
The pointer passed into the macro.
Description
Sets the idx element of the S-function's pointer work vector to
pointer. 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.
Languages
C, C++
Examples
The following statement
typedef struct Color_tag {int r; int b; int g;} Color;
Color *p = malloc(sizeof(Color));
ssSetPWorkValue(S, 0, p);
sets the first element of the pointer work vector to a pointer to the allocated
Color structure.
See Also
Version History
Introduced before R2006a