Main Content

Model Arrays of Buses

Arrays of buses represent structured data compactly, eliminating the need to include multiple copies of the same buses. Arrays of buses support iterative processing with for-each subsystems.

The input buses for an array of buses must be nonvirtual and of the same data type, having the same names, hierarchies, and attributes for the bus elements.

The example model demonstrates multiple ways to use an array of buses. To simulate the model, on the Modeling tab of the Simulink® Toolstrip, click Run. Alternatively, in the MATLAB® Command Window, enter these commands.

mdl = "ArraysOfBuses";
open_system(mdl)
sim(mdl);

ArraysOfBuses model after simulation

In this model, a Vector Concatenate block creates an array of buses from nonvirtual buses. Bus Creator blocks create two of the nonvirtual buses, and a Constant block creates a nonvirtual bus from a struct.

The model uses the array of buses with:

  • Selector blocks, to extract buses from the array of buses.

  • An Assignment block, to assign new values to a bus in the array.

  • A For Each Subsystem block, to iteratively process each bus in the array.

  • A Memory block, to output the array of buses input from the previous time step.

See Also

Topics