Documentation

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.

ssGetIWorkValue

Get an element of a block's integer work vector

Syntax

int_T ssGetIWorkValue(SimStruct *S, int_T idx)

Arguments

S

SimStruct representing an S-Function block.

idx

Index of the element returned by this function.

Returns

The int_T value stored in the idx element of the integer work vector for this S-function. Returns NULL if no value was assigned into the idx element of the IWork vector.

Description

Use this macro in the simulation loop, mdlInitializeConditions, or mdlStart routines to obtain an element of the IWork vector. The vector consists of elements of type int_T and is of length ssGetNumIWork(S). Typically, this vector is initialized in mdlStart or mdlInitializeConditions, updated in mdlUpdate, and used in mdlOutputs.

Languages

C, C++

Example

The following statement

int_T v = ssGetIWorkValue(S, 0);

is equivalent to

int_T* wv = ssGetIWork(S);
int_T v = wv[0];

For a complete example using ssGetIWork, see the S-function stvctf.c used in sfcndemo_stvctf.

Introduced before R2006a

Was this topic helpful?