Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Bus Selector

Select signals from incoming bus

Library

Signal Routing

Description

The Bus Selector block outputs a specified subset of the elements of the bus at its input. The block can output the specified elements as separate signals or as a new bus.

    Note   Simulink® software hides the name of a Bus Selector block when you copy it from the Simulink library to a model.

By default, Simulink implicitly converts a nonbus signal to a bus signal to support connecting the signal to a Bus Selector block. To prevent Simulink from performing that conversion, in the Model Configuration Parameters > Diagnostics > Connectivity pane, set the Non-bus signals treated as bus signals diagnostic to warning or error.

When the block outputs separate elements, it outputs each element from a separate port from top to bottom of the block. See Port Location After Rotating or Flipping for a description of the port order for various block orientations.

In the Simulink Editor, as you draw a new signal line close to output side of a Bus Selector block and 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 in either of these cases:

  • There is no bus input signal 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 bus parameter.

    Tip:   For models that include bus signals composed of many bus elements that feed subsystems, consider using the In Bus Element and Out Bus Element blocks. You can use these bus element port blocks instead of Inport with Bus Selector blocks for inputs, and Outport with Bus Creator blocks for outputs. These bus element port 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.

Reorder or Remove Signals

To reorder the selected signals that the Bus Selector block includes in the bus signal that it produces, click Up, Down, or Remove.

You can select multiple contiguous signals in the Signals in the bus list to remove or reorder.

You cannot rearrange leaf signals within a bus. For example, you can move bus signal Bus1 up or down in the list, but you cannot reorder any of the bus elements of Bus1.

After you click a button, click Apply.

Array of Buses Support

When using arrays of buses with a Bus Selector block, these limitations apply:

  • You cannot connect an array of buses signal to a Bus Selector block. To work with an array of buses signal, select with a Selector block the index for the bus element that you want to use with the Bus Selector block. Then use that selected bus element with the Bus Selector block.

  • You cannot assign into a subbus that is an array of buses.

Data Type Support

A Bus Selector block accepts and outputs real or complex values of any data type supported by Simulink software, including fixed-point and enumerated data types.

For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink.

Parameters

Signals in the bus

Shows the signals in the input bus.

Settings

To refresh the display to reflect modifications to the bus connected to the block, click Refresh.

Tips

  • Use Select>> to select signals to output.

  • To find the source of any signal entering the block, select the signal in the list and click Find. The Simulink software opens and highlights the system containing the signal source.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Enable regular expression

Enable the use of MATLAB® regular expressions for filtering signal names. For example, entering t$ in the Filter by name edit box displays all signals whose names end with a lowercase t (and their immediate parents). For details, see Regular Expressions (MATLAB).

Settings

Default: On

On

Allow use of MATLAB regular expressions for filtering signal names.

Off

Disable use of MATLAB regular expressions for filtering signal names. Filtering treats the text you enter in the Filter by name edit box as a literal character vector.

Dependencies

Selecting the Options button on the right-hand side of the Filter by name edit box ( ) enables this parameter.

Show filtered results as a flat list

Uses a flat list format to display the list of filtered signals, based on the search text in the Filter by name edit box. The flat list format uses dot notation to reflect the hierarchy of bus signals. The following is an example of a flat list format for a filtered set of nested bus signals.

Settings

Default: Off

On

Display the filtered list of signals using a flat list format, indicating bus hierarchies with dot notation instead of using a tree format.

Off

Display filtered bus hierarchies using a tree format.

Dependencies

Selecting the Options button on the right-hand side of the Filter by name edit box ( ) enables this parameter.

Selected signals

Shows the signals to be output.

Settings

Default: signal1,signal2

You can change the list by using the Up, Down, and Remove buttons.

Tips

  • Port connectivity is maintained when the signal order is changed.

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

Command-Line Information

See Block-Specific Parameters for the command-line information.

Output as bus

Output the selected elements as a bus.

Settings

Default: Off

On

Output the selected elements as a bus.

Off

Output the selected elements as standalone signals, each from an output port that is labeled with the corresponding element's name.

Tips

  • The output bus is virtual. To produce nonvirtual bus output, insert a Signal Conversion block after the Bus Selector block. Set the Signal Conversion block Output parameter to Nonvirtual bus and use a Simulink.Bus bus object for the Data type parameter. For an example, see the Signal Conversion documentation.

  • If the Selected signals list box includes only one signal and you enable Output as bus, then:

    • If the selected signal is a non-bus signal, it is treated as a non-bus signal (it is not wrapped in a bus).

    • If the selected signal is a bus signal, then the output is that bus signal.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Examples

For an example of how the Bus Selector block works, see the busdemo model.

Characteristics

Data types

Double | Single | Boolean | Base Integer | Fixed-Point | Enumerated | Bus

Multidimensional signals

Yes

Variable-size signals

Yes

Code generation

Yes

Introduced before R2006a

Was this topic helpful?