Contents

Arrays of Buses in Models

Blocks That Support Arrays of Buses

The following blocks support arrays of buses:

Block Parameter Settings

The following table describes the block parameter settings for blocks that support arrays of buses. This information is also in the reference pages for each of these blocks.

For usage information for bus-related blocks, see Arrays of Buses with Bus-Related Blocks.

BlockBlock Parameters Settings
Memory

Initial condition — Only this parameter (which may be, but does not have to be, a structure) is scalar-expanded to match the dimensions of the array of buses.

Merge
  • Allow unequal port widths — Clear this parameter.

  • Number of inputs — Set to a value of 2 or greater.

  • Initial condition — Only this parameter (which may be a structure) is scalar-expanded to match the dimensions of the array.

Multiport Switch

Number of data ports — Set to a value of 2 or greater.

Signal Conversion

Output — Set to Signal copy.

Switch

Threshold — Specify a scalar threshold.

Arrays of Buses with Bus-Related Blocks

To select a signal within an array of buses:

  1. Use a Selector block to find the appropriate bus within the array of buses.

  2. Use a Bus Selector block to select the signal.

To assign a value to a signal within an array of buses:

  1. Use a Bus Assignment block to assign a value to a bus element.

  2. Use the Assignment block to assign the bus to the array of buses.

Bus Selector and Bus Assignment blocks can only accept scalar buses, not arrays of buses.

A Bus Creator block can accept an array of buses as input, but cannot have an array of buses as output.

For details, see Set Up a Model to Use Arrays of Buses.

Set Up a Model to Use Arrays of Buses

Setting up a model to use an array of buses usually involves basic tasks similar to these:

  1. Define the array of buses (see Define an Array of Buses).

  2. Add a subsystem for performing iterative processing on each element of the array of buses. For example, use a For Each Subsystem block or an Iterator block.

     Perform Iterative Processing

  3. Connect the array of buses signal from the Concatenate block to the iterative processing subsystem.

  4. Model your scalar algorithm within the iterative processing subsystem (for example, a For Each subsystem).

    1. Operate on the array of buses (using Selector and Assignment blocks).

    2. Use the Bus Selector and Bus Assignment blocks to select elements from, or assign elements to, a scalar bus within the subsystem.

     Assign values into an array of buses

     Select bus elements from an array of buses

  5. Optionally, import or log array of buses data.

     Import array of buses data

     Log Array of Buses Signals

The resulting model includes these components.

Set Diagnostic

Before you run a simulation on a model that uses an array of buses, in the Configuration Parameters > Diagnostics > Connectivity pane, check that the Mux blocks used to create bus signals parameter uses the default setting of error.

Signal Line Style

After you create an array of buses and update the diagram, the line style for the array of buses signal is a thicker version of the signal line style for a nonvirtual bus signal.

For example, in the sldemo_bus_arrays model, the Scalar Bus signal is a nonvirtual bus signal, and the Bus Array output signal of the Concatenate block is an array of buses signal.

Was this topic helpful?