Main Content

Output Signal Functions

LibBlockAssignOutputSignal(portIdx, ucv, lcv, sigIdx, rhs)

Based on the output port number (portIdx), the user control variable (ucv), the loop control variable (lcv), the signal index (sigIdx), and the output signal destination, LibBlockAssignOutputSignal assigns a block’s output to a specified right hand side value, (rhs).

See LibBlockAssignOutputSignal in customstoragelib.tlc.

LibBlockGetNumFcnCallOutputs(block)

Returns the number of function call outputs for the specified block. This function takes the block record as an input argument.

See LibBlockGetNumFcnCallOutputs in block_api.tlc.

LibBlockGetNumFcnCallOutputsDsts(block)

Returns the number of function call output destinations for the specified block. This function takes the block record as an input argument.

See LibBlockGetNumFcnCallOutputDsts in block_api.tlc.

LibBlockNumOutputPorts(block)

Returns the number of data output ports of a block (excludes control and state ports).

See LibBlockNumOutputPorts in blocklib.tlc.

LibBlockOutputHasSymbolicWidth(portIdx)

Returns 1 (true) if the specified block ouput port index has symbolic dimensions, and 0 (false) otherwise. This function takes the port index as an input argument.

See LibBlockOutputHasSymbolicWidth in blkio_api.tlc.

LibBlockOutputPortIndexMode(block, pidx)

Purpose

Determines the index mode of a block's output port.

Description

If a block's output port is set as an index port and its indexing base is marked as zero-based or one-based, this information is written into the model.rtw file. LibBlockOutputPortIndexMode queries the indexing base to branch to different code according to what the output port indexing base is.

Example

%if LibBlockOutputPortIndexMode(block, idx) == "Zero-based"
  ...
%elseif LibBlockOutputPortIndexMode(block, idx) == "One-based"
  ...
%else
  ...
%endif

Arguments

block — Block record

pidx — Port index

Returns

"" for a nonindex port, and "Zero-based" or "One-based" otherwise.

See LibBlockOutputPortIndexMode in blkiolib.tlc.

LibBlockOutputPortIsContinuousQuantity(portIdx)

Returns whether the output port represents a co-simulation signal. This function takes the port index as an input argument.

See LibBlockOutputPortIsContinuousQuantity in blkio_api.tlc.

LibBlockOutputSignal(portIdx, ucv, lcv, sigIdx)

Based on the output port number (portIdx), the user control variable (ucv), the loop control variable (lcv), the signal index (sigIdx), and the output signal destination, LibBlockOutputSignal returns a reference to a block output signal.

The returned value is a valid lvalue (left-side value) for an expression. The block output destination can be a location in the block I/O vector (another block's input), the state vector, or an external output.

Note

Do not use LibBlockOutputSignal to access the address of an output signal.

The code generator tracks when a variable (e.g., a signal or parameter) is accessed by its address. To access the address of an output signal, use LibBlockOutputSignalAddr as in the following example:

%assign yAddr = LibBlockOutputSignalAddr(0, "", lcv, sigIdx)
x = %<yAddr>;

See LibBlockOutputSignal in blkiolib.tlc.

LibBlockOutputSignalAddr(portIdx, ucv, lcv, sigIdx)

Returns a string that provides the memory address of the specified block output port signal.

When an output signal address is required, you must use LibBlockOutputSignalAddr instead of taking the address that is returned by LibBlockOutputSignal. For example, LibBlockOutputSignal can return a literal constant, such as 5 (i.e., an invariant output signal). When LibBlockOutputSignalAddr is called on an invariant signal, the signal is declared as a const instead of being placed as a literal constant in the generated code.

Note that unlike LibBlockOutputSignal, the last argument, sigIdx, is not overloaded. Hence, if the output signal is complex, the address of the complex container is returned.

Example

To get the address of a wide output signal and pass it to a user function for processing, you could use

%assign u = LibBlockOutputSignalAddr(0, "", "", 0)
%assign y = LibBlockOutputSignal(0, "", "", 0)
%<y> = myfcn (%<u>);

See LibBlockOutputSignalAddr in blkiolib.tlc.

LibBlockOutputSignalAliasedThruDataTypeName
(portIdx, reim)

Returns the type name string (e.g., int_T, ... creal_T) of the aliased data type corresponding to the specified block output port.

Specify the reim argument as "" if you want the complete signal type name. For example, if reim == "" and the first output port is real and complex, the data type placed in dtname is creal_T:

%assign dtname = LibBlockOutputSignalAliasedThroughDataTypeName(0x,"")

Specify the reim argument as tRealPart if you want the raw element type name. For example, if reim == tRealPart and the first output port is real and complex, the data type name returned is real_T.

%assign dtname = LibBlockOutputSignalAliasedThroughDataTypeName(0,tRealPart)

See LibBlockOutputSignalAliasedThruDataTypeName in blkiolib.tlc.

LibBlockOutputSignalBeingMerged(portIdx)

Returns whether the specified output port is connected to a Merge block.

See LibBlockOutputSignalBeingMerged in blkio_api.tlc.

LibBlockOutputSignalConnected(portIdx)

Returns 1 if the specified output port is connected to a block other than the Ground block and 0 otherwise.

See LibBlockOutputSignalConnected in blkio_api.tlc.

LibBlockOutputSignalDataTypeId(portIdx)

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

If the output port signal is complex, LibBlockOutputSignalDataTypeId returns the data type of the real (or the imaginary) part of the signal.

See LibBlockOutputSignalDataTypeId in blkiolib.tlc.

LibBlockOutputSignalDataTypeName(portIdx, reim)

Returns the type name string (e.g., int_T, ... creal_T) of the data type corresponding to the specified block output port.

Specify the reim argument as "" if you want the complete signal type name. For example, if reim=="" and the first output port is real and complex, the data type name placed in dtname is creal_T.

%assign dtname = LibBlockOutputSignalDataTypeName(0x,"")

Specify the reim argument as tRealPart if you want the raw element type name. For example, if reim==tRealPart and the first output port is real and complex, the data type name returned is real_T.

%assign dtname = LibBlockOutputSignalDataTypeName(0,tRealPart)

See LibBlockOutputSignalDataTypeName in blkiolib.tlc.

LibBlockOutputSignalDimensions(portIdx)

Returns the dimensions of the specified block output port.

See LibBlockOutputSignalDimensions in blkio_api.tlc.

LibBlockOutputSignalIsComplex(portldx)

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

See LibBlockOutputSignalIsComplex in blkio_api.tlc.

LibBlockOutputSignalIsConstExpr(portIdx)

Returns 1 (true) if the output signal is a constant expression, and 0 (false) otherwise. Note that a constant expression is constant even if a block output function calls it. This function takes the port index as an input argument.

See LibBlockOutputSignalIsConstExpr in blkio_api.tlc.

LibBlockOutputSignalIsExpr(portldx)

Returns 1 (true) if the output signal is an expression, and 0 (false) otherwise.

See LibBlockOutputSignalIsExpr in blkio_api.tlc.

LibBlockOutputSignalIsExprInOutputs(portIdx)

Returns 1 (true) if the output signal is an expression in the outputs function, and 0 (false) otherwise. You can use this function as a low-level utility to get access to what the value will be when generating the block's output code. Use this function in the BlockInstanceSetup function. This function takes the port index as an input argument.

See LibBlockOutputSignalIsExprInOutputs in blkio_api.tlc.

LibBlockOutputSignalIsFrameData(portIdx)

Returns 1 if the specified block output port is frame based, 0 otherwise.

See LibBlockOutputSignalIsFrameData in blkio_api.tlc.

LibBlockOutputSignalIsNonConstExpr(portIdx)

Returns 1 (true) if the output signal is an non-constant expression, and 0 (false) otherwise. This function takes the port index as an input argument.

See LibBlockOutputSignalIsNonConstExpr in blkio_api.tlc.

LibBlockOutputSignalIsTrivialExpr(portIdx)

Returns 1 (true) if the output signal is a trivial expression, and 0 (false) otherwise. This function takes the port index as an input argument.

See LibBlockOutputSignalIsTrivialExpr in blkio_api.tlc.

LibBlockOutputSignalLocalSampleTimeIndex
(portIdx)

Returns the local sample time index corresponding to the specified block output port.

See LibBlockOutputSignalLocalSampleTimeIndex in blkio_api.tlc.

LibBlockOutputSignalNumDimensions(portIdx)

Returns the number of dimensions of the specified block output port.

See LibBlockOutputSignalNumDimensions in blkio_api.tlc.

LibBlockOutputSignalOffsetTime(portIdx)

Returns the offset time corresponding to the specified block output port.

See LibBlockOutputSignalOffsetTime in blkiolib.tlc.

LibBlockOutputSignalSampleTime(portIdx)

Returns the sample time corresponding to the specified block output port.

See LibBlockOutputSignalSampleTime in blkiolib.tlc.

LibBlockOutputSignalSampleTimeIndex(portIdx)

Returns the sample time index corresponding to the specified block output port.

See LibBlockOutputSignalSampleTimeIndex in blkiolib.tlc.

LibBlockOutputSignalSymbolicDimensions(portIdx)

Returns the symbolic dimensions of specified block output port.

See LibBlockOutputSignalSymbolicDimensions in blkiolib.tlc.

LibBlockOutputSignalSymbolicWidth(portIdx)

Returns the symbolic width of specified block output port.

See LibBlockOutputSignalSymbolicWidth in blkiolib.tlc.

LibBlockOutputSignalWidth(portIdx)

Returns the width of the specified block output port.

See LibBlockOutputSignalWidth in blkio_api.tlc.

LibBlockOutputSignalUnitExpr(portIdx)

Returns the type name string of the units corresponding to the specified output port. This function takes the port index as an input argument.

See LibBlockOutputSignalUnitExpr in blkio_api.tlc.

LibBlockOutputSignalUnitId(portIdx)

Returns the numeric ID corresponding to the units of the specified block output port. This function takes the port index as an input argument.

See LibBlockOutputSignalUnitId in blkio_api.tlc.

Related Topics