Main Content

slreportgen.utils.traceSignal

Trace signal to source or destination

Description

example

[blks,ports,portnums] = slreportgen.utils.traceSignal(port) traces the signal entering or leaving the specified port to the nonvirtual source or destination. If port is an input port, the function returns the nonvirtual source block, port, and port number of the signal. If port is an output port, slreportgen.utils.traceSignal returns the nonvirtual destination blocks, ports, and port numbers of the signal. If the function is unable to trace the signal, it returns -1 as the value of blks.

[blks,ports,portnums] = slreportgen.utils.traceSignal(portArray) traces the signal entering or leaving the ports specified by portArray to the nonvirtual sources or destinations. If the first port in portArray is an output port, the function treats all the ports as output ports. If the first port is an input port, the function treats all the ports as input ports. If the function is unable to trace a signal, the blks cell array contains a -1 for the entry corresponding to the untraceable port.

[blks,ports,portnums] = slreportgen.utils.traceSignal(___,"Nonvirtual",false) traces signals to the graphical sources or destinations instead of to the nonvirtual sources or destinations and can include any of the input arguments in previous syntaxes.

Examples

collapse all

model= 'f14';
load_system(model)
srcBlock = 'f14/Aircraft Dynamics Model/Transfer Fcn.1';
ports = get_param(srcBlock, 'PortHandles');
[sb,sp,spn] = slreportgen.utils.traceSignal(ports.Inport);
fprintf('Block with input signal to trace: %s\n',srcBlock)  
fprintf('Source block: %s\n',sb)
fprintf('Source port number: %d\n',spn)
bdclose(model)
Block with input signal to trace: f14/Aircraft Dynamics Model/Transfer Fcn.1
Source block: f14/Aircraft
Dynamics
Model/Sum2
Source port number: 1

Input Arguments

collapse all

Input or output port, specified as a handle.

Input or output ports, specified as an array of handles.

Output Arguments

collapse all

Blocks, returned as one of the following values:

  • -1, if a signal cannot be traced.

  • Character vector, if a signal is traced to a single source or destination.

  • N-by-1 cell array of character vectors, if a signal is traced to multiple destinations.

  • 1-by-M cell array, if multiple signals are traced. M is the number of signals traced. The cell array can contain:

    • -1, if a signal cannot be traced

    • Character vectors for signals that are traced to a single source or destination.

    • N-by-1 cell array of character vectors for signals traced to multiple destinations.

Ports, returned as one of the following values:

  • Handle, if a signal is traced to a single source or destination.

  • N-by-1 array of handles, if a signal is traced to multiple destinations.

  • M-by-1 cell array, if multiple signals are traced. M is the number of signals traced. The cell array can contain:

    • Handles

    • N-by-1 array of handles for signals traced to multiple destinations.

Ports, returned as one of the following values:

  • Integer, if a signal is traced to a single source or destination.

  • N-by-1 cell array of integers, if a signal is traced to multiple destinations.

  • 1-by-M cell array, if multiple signals are traced. M is the number of signals traced. The cell array can contain:

    • Integers

    • N-by-1 cell array of integers for signals traced to multiple destinations

Introduced in R2018b