Bus Selector

Select signals from incoming bus

  • Library:
  • Simulink / Commonly Used Blocks

    Simulink / Signal Routing

    HDL Coder / Signal Routing

Description

The Bus Selector block outputs the signals you select from the input bus. The block can output the selected elements separately or in a new virtual bus.

Ports

Input

expand all

Input bus, which can be virtual or nonvirtual.

For arrays of buses, you must use a Selector block to select the bus that you want to use with the Bus Selector block.

Data Types: bus

Output

expand all

Selected bus elements of an input bus.

For each output signal, this block uses a separate port from the top to the bottom of the block. If the block is rotated, see Port Location After Rotating or Flipping for the port order of various block orientations.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus
Complex Number Support: Yes

Parameters

expand all

List of elements in the input bus from which to select output signals.

If you change a signal name while the Block Parameters dialog box is open, you can see the updated name by clicking Refresh.

To highlight the source of a signal entering the block, select the signal in the list and click Find.

Programmatic Use

Block Parameter: InputSignals
Type: cell array
Values: signal names

Search term for filtering displayed input signals, specified as text. Do not enclose the search term in quotation marks. The filter does a partial string search.

To access the filtering options, click the Show filtering options button to the right of the Filter by name box.

Option to filter the displayed input signals by regular expression.

When this parameter is enabled, entering t$ in the Filter by name box displays all signals whose names end with a lowercase t (and their immediate parents). For details, see Regular Expressions (MATLAB).

Dependencies

To access this parameter, click the Show filtering options button on the right side of the Filter by name box.

Option to display filtered results as a flat list that uses dot notation to reflect the hierarchy of buses. By default, the filtered signals appear in a hierarchical tree.

Dependencies

To access this parameter, click the Show filtering options button on the right side of the Filter by name box.

The selected elements of the input bus.

To specify an output signal, select a signal from the Signals in the bus list, and then click the Select button. The signal is added at the end of the Selected signals list. To add signals below an existing signal, select a signal in the Selected signals list before you click Select. Signals are added below the signal you selected.

If you select multiple signals from the Signals in the bus list, the order in which you select them is the order in which Simulink® inserts them in the Selected signals list.

If an output signal listed in the Selected signals list is not an input to the Bus Selector block, the signal name starts with three question marks (???).

To change the order of the output bus elements, use the Up and Down buttons. Port connectivity with downstream blocks is maintained when you change the signal order.

To remove bus elements from the block output, use the Remove button. You can select multiple contiguous signals to move or remove.

Tip

In the Simulink Editor, as you draw a new signal line close to the output side of a Bus Selector block when all output ports are already connected, Simulink:

  • Adds a port

  • Prompts you to specify the signal to be selected

You cannot use this automatic port addition approach if:

  • A bus input is not connected to the Bus Selector block.

  • You do not specify a signal in response to the prompt that appears when you draw a signal line close to the Bus Selector block icon.

  • You select the Output as virtual bus parameter.

Programmatic Use

Block Parameter: OutputSignals
Type: character vector
Values: character vector in the form of 'signal1,signal2'
Default: none

Option to output the selected elements as a virtual bus.

By default, the block outputs each of the selected elements from a separate output port that is labeled with the corresponding bus element name. When this parameter is enabled, the block outputs the selected elements from one port, grouped in a virtual bus.

The output bus is virtual. To convert the output to a nonvirtual bus, insert a Signal Conversion block after the Bus Selector block. Set the Signal Conversion block Output parameter to Nonvirtual bus and set the Data type to a Simulink.Bus object.

When the Selected signals list includes only one signal and you enable Output as virtual bus, then that signal is not wrapped in a bus. For example, if the signal is a bus, the output signal is that bus. If the signal is not a bus, the output signal is not a bus.

Programmatic Use

Block Parameter: OutputAsBus
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Block Characteristics

Data Types

Boolean | bus | double | enumerated | fixed point | integer | single | string

Direct Feedthrough

yes

Multidimensional Signals

yes

Variable-Size Signals

yes

Zero-Crossing Detection

no

Tips

For buses at subsystem and model interfaces, you can use In Bus Element blocks instead of an Inport block with a Bus Selector block. In Bus Element blocks:

  • Reduce signal line complexity and clutter in a block diagram.

  • Make it easier to change the interface incrementally.

  • Allow access to a bus element closer to the point of usage, avoiding the use of a Bus Selector and Goto block configuration.

Extended Capabilities

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

Introduced before R2006a