Writing S-Functions | ![]() ![]() |
Set an element of a block's pointer work vector.
Syntax
Arguments
S
SimStruct representing an S-Function block.
idx
Index of the element to be set
Description
Sets the idx
element of S
'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. This macro returns the pointer that it sets.
Example
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.
Languages
See Also
ssGetNumPWork, ssGetPWork
, ssGetPWorkValue
![]() | ssSetPlacementGroup | ssSetRWorkValue | ![]() |