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 an element of a block's floating-point work vector


real_T ssGetRWorkValue(SimStruct *S, int_T idx)



SimStruct representing an S-Function block.


Index of the element returned by this function.


The real_T value stored in the RWork vector element specified by the index 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.


C, C++


The following statement

real_T v = ssGetRWorkValue(S, 0);

is equivalent to

real_T* wv = ssGetRWork(S);
real_T v = wv[0];

For complete examples using ssGetRWork, see the S-function sfun_dynsize.c used in sfcndemo_sfun_dynsize and the S-function sfunmem.c used in sfcndemo_sfunmem.

Introduced before R2006a

Was this topic helpful?