Target Language Compiler | ![]() ![]() |
Target Language Compiler Functions
This section lists the Target Language Compiler functions grouped by category, and provides a description of each function. To view the source code for a function, click on its name.
Common Function Arguments
Several functions take similar or identical arguments. To simplify the reference pages, some of these arguments are documented in detail here instead of in the reference pages.
Argument |
Description |
|
Refers to an input or output port index, starting at zero. For example the first input port of an S-function is 0. |
|
User control variable. This is an advanced feature that overrides the lcv and sigIdx parameters. When used within an inlined S-function, it should generally be specified as "" . |
|
Loop control variable. This is generally generated by the %roll directive via the second %roll argument (e.g., lcv=RollThreshold ) and should be passed directly to the library function. It will contain either "" , indicating that the current pass through the %roll is being inlined, or it will be the name of a loop control variable such as "i" , indicating that the current pass through the %roll is being placed in a loop. Outside of the %roll directive, this is usually specified as "" . |
or idx |
Signal index. Sometimes referred to as the signal element index. When accessing specific elements of an input or output signal directly, the call to the various library routines should have ucv="" , lcv="" , and sigIdx equal to the desired integer signal index starting at 0. Note, for complex signals, sigIdx can be an overloaded integer index specifying both whether the real or imaginary part is being accessed and which element. When accessing these items inside of a %roll , the sigIdx generated by the %roll directive should be used.
Most functions that take a sigIdx argument accept it in an overloaded form where sigIdx can be:
idx name is used when referring to a state or work vector.Functions that accept the three arguments ucv , lcv , sigIdx (or idx ) are called differently depending upon whether or not they are used with in a %roll directive. If they are used within a %roll directive, ucv is generally specified as "" and lcv and sigIdx are the same as those specified in the %roll directive. If they are not used with in a %roll directive, ucv and lcv are generally specified as "" and sigIdx specifies which index to access. |
paramIdx |
Parameter index. Sometimes referred to as the parameter element index. The handling of this parameter is very similar to sigIdx (i.e., it can be # , re# , or im# ). |
stateIdx |
State index. Sometimes referred to as the state vector element index. It must evaluate to an integer where the first element starts at 0 . |
Overloading sigIdx
The signal index (sigIdx
sometimes written as idx
) can be overloaded when passed to most library functions. Suppose we are interested in element 3 of a signal, and ucv=""
, lcv=""
. The following table shows:
sigIdx
sigIdx
returns
Note that "container" in the following table refers to the object that encapsulates both the real and imaginary parts of the number, e.g., creal_T
defined in matlabroot
/extern/include/tmwtypes.h
.
The following table shows values of idx
, whether the signal is complex, and what the function that uses idx
returns.
Notes
ucv
is not an empty string (" "), then the ucv
is used instead of sigIdx
in the above examples and both lcv
and sigIdx
are ignored.
ucv
is empty but lcv
is not empty, then this function returns "&y%<portIdx>[%<lcv>]"
and sigIdx
is ignored.
"rollVars"
as the argument to the %roll
directive.
![]() | Obsolete Functions | Input Signal Functions | ![]() |