Get an element of a block's floating-point work vector
real_T ssGetRWorkValue(SimStruct *S, int_T idx)
Use to obtain the idx element of the floating-point work vector used by the block represented by S. The vector consists of elements of type real_T and is of length ssGetNumRWork(S). Typically, this vector is initialized in mdlStart or mdlInitializeConditions, updated in mdlUpdate, and used in mdlOutputs. You can use this macro or ssGetRWork to get the current values of the work vector in the simulation loop, mdlInitializeConditions, or mdlStart routines.
The following statement
real_T v = ssGetRWorkValue(S, 0);
is equivalent to
real_T* wv = ssGetRWork(S); real_T v = wv;
For complete examples using ssGetRWork, see the S-function sfun_dynsize.csfun_dynsize.c used in sfcndemo_sfun_dynsizesfcndemo_sfun_dynsize and the S-function sfunmem.csfunmem.c used in sfcndemo_sfunmemsfcndemo_sfunmem.