Output Signal Functions

LibBlockNumOutputPorts(block)

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

See LibBlockNumOutputPorts in matlabroot/rtw/c/tlc/lib/blocklib.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

idx — Port index

Returns

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

See LibBlockOutputPortIndexMode in matlabroot/rtw/c/tlc/lib/blkiolib.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 the appropriate 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.

The Real-Time Workshop 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 matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalAddr(portIdx, ucv, lcv, sigIdx)

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

When an output signal address is needed, 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 matlabroot/rtw/c/tlc/lib/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 matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalBeingMerged(portIdx)

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

See LibBlockOutputSignalBeingMerged in matlabroot/rtw/c/tlc/lib/blkiolib.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 matlabroot/rtw/c/tlc/lib/blkiolib.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 matlabroot/rtw/c/tlc/lib/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 matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalDimensions(portIdx)

Returns the dimensions of the specified block output port.

See LibBlockOutputSignalDimensions in matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalIsComplex(portldx)

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

See LibBlockOutputSignalIsComplex in matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalIsFrameData(portIdx)

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

See LibBlockOutputSignalIsFrameData in matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalLocalSampleTimeIndex
(portIdx)

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

See LibBlockOutputSignalLocalSampleTimeIndex in matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalNumDimensions(portIdx)

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

See LibBlockOutputSignalNumDimensions in matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalOffsetTime(portIdx)

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

See LibBlockOutputSignalOffsetTime in matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalSampleTime(portIdx)

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

See LibBlockOutputSignalSampleTime in matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalSampleTimeIndex(portIdx)

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

See LibBlockOutputSignalSampleTimeIndex in matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

LibBlockOutputSignalWidth(portIdx)

Returns the width of the specified block output port.

See LibBlockOutputSignalWidth in matlabroot/rtw/c/tlc/lib/blkiolib.tlc.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS