Target Language Compiler    

Parameter Functions

LibBlockMatrixParameter(param,rucv,rlcv,ridx,cucv,clcv,cidx)

Returns the appropriate matrix parameter for a block given the row and column user control variables (rucv, cucv), loop control variables (rlcv, clcv), and indices (ridx, cidx). Generally, blocks should use LibBlockParameter. If you have a matrix parameter, you should write it as a column major vector and access it via LibBlockParameter.

The row and column index arguments are similar to the arguments for LibBlockParameter. The column index (cidx) is overloaded to handle complex numbers.

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.

LibBlockMatrixParameterAddr(param,rucv,rlcv,ridx,cucv,clcv,cidx)

Returns the address of a matrix parameter.

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.

LibBlockMatrixParameterBaseAddr(param)

Returns the base address of a matrix parameter.

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.

LibBlockParameter(param, ucv, lcv, sigIdx)

Based on the parameter reference (param), the user control variable (ucv), the loop control variable (lcv), the signal index (sigIdx), and the state of parameter inlining, this function returns the appropriate reference to a block parameter.

The returned value is always a valid rvalue (right-side value for an expression). For example,

Case
Function Call
May Produce
1
LibBlockParameter(Gain, "i", lcv, sigIdx)
rtP.blockname[i]
2
LibBlockParameter(Gain, "i", lcv, sigIdx)
rtP.blockname
3
LibBlockParameter(Gain, "", lcv, sigIdx)
p_Gain[i]
4
LibBlockParameter(Gain, "", lcv, sigIdx)
p_Gain
5
LibBlockParameter(Gain, "", lcv, sigIdx)
4.55
6
LibBlockParameter(Gain, "", lcv, sigIdx)
rtP.blockname.re
7
LibBlockParameter(Gain, "", lcv, sigIdx)
rtP.blockname.im

To illustrate the basic workings of this function, assume a noncomplex vector signal where Gain[0]=4.55:

Note case 4. Even though inline parameter is true, the parameter must be placed in memory (RAM) since it's accessed inside a for-loop.

For example, if the parameter field had the MATLAB expression '2*a', this function will return the C expression '(2 * a)'. The list of functions supported by this function is determined by the functions FcnConvertNodeToExpr and FcnConvertIdToFcn. To enhance functionality, augment or update either of these functions.

Note that certain types of expressions are not supported such as x * y where both x and y are nonscalars.

See the Real-Time Workshop documentation about tunable parameters for more details on the exact functions and syntax that is supported.

Warning

Do not use this function to access the address of a parameter, or you may end up referencing a number (i.e., &4.55) when the parameter is inlined. You can avoid this situation by using LibBlockParameterAddr().

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.

LibBlockParameterAddr(param, ucv, lcv, idx)

Returns the address of a block parameter.

Using LibBlockParameterAddr to access a parameter when the global InlineParameters variable is equal to 1 will cause the variable to be declared "const" in RAM instead of being inlined.

Also, trying to access the address of an expression when inline parameters is on and the expression has multiple tunable/rolled variables in it will result in an error.

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.

LibBlockParameterBaseAddr(param)

Returns the base address of a block parameter.

Using LibBlockParameterBaseAddr to access a parameter when the global InlineParameters variable is equal to one will cause the variable to be declared "const" in RAM instead of being inlined.

Note that Accessing the address of an expression when Inline parameters is on and the expression has multiple tunable/rolled variables in it will result in an error.

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.

LibBlockParameterDataTypeId(param)

Returns the numeric ID corresponding to the data type of the specified block parameter.

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.

LibBlockParameterDataTypeName(param, reim)

Returns the name of the data type corresponding to the specified block parameter.

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.

LibBlockParameterDimensions(param)

Returns a row vector of length N (where N >= 1) giving the dimensions of the parameter data.

For example:

This function differs from LibBlockParameterSize in that it returns the dimensions of the parameter data prior to collapsing the Matrix parameter to a column-major vector. The collapsing occurs for run-time parameters that have specified their outputAsMatrix field as False.

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.

LibBlockParameterIsComplex(param)

Returns 1 if the specified block parameter is complex, 0 otherwise.

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.

LibBlockParameterSize(param)

Returns a vector of size 2 in the format [nRows, nCols] where nRows is the number of rows and nCols is the number of columns.

See function in matlabroot/rtw/c/tlc/lib/paramlib.tlc.


  Output Signal Functions Block State and Work Vector Functions