Set an element of a block's pointer work vector
void *ssSetPWorkValue(SimStruct *S, int_T idx, void *pointer)
S
SimStruct representing an S-Function block.
idx
Index of the element to be set.
pointer
New pointer element.
The pointer passed into the macro.
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.
C, C++
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.