Overview of Composite Signal Techniques

You can use composite signals to reduce visual complexity in a model. A composite signal is a signal that is composed of other signals. The individual element signals originate separately and join to form the composite signal. You can extract individual signals from the composite signal downstream and use the extracted signal as if it never was part of a composite signal.

Use one or more of these techniques to combine signals into a composite signal.

To select a composite signal technique that meets your modeling requirements, see Select a Composite Signal Technique.


A bus signal (also called a bus) is analogous to a bundle of wires held together by tie wraps. Simulink® implements a bus as a name-based hierarchical structure. A Simulink bus is not like a hardware bus, such as the bus in computer hardware architecture. A Simulink bus is more like a programmatic structure defined in a language such as MATLAB® or C.

A bus is composed of signals that are called elements. The constituent signals retain their separate identities within the bus and can be of any type or types, including other buses nested to any level. The elements of a bus can be:

  • Mixed data type signals (for example, double, integer, fixed-point)

  • Mixed scalar and vector elements

  • Mixed of real and complex signals

  • Other buses

  • Multidimensional signals

Not all blocks can accept buses. See Bus-Capable Blocks for more information about which blocks can handle which types of buses. Also, see Use Buses for Inports and Outports.

For example, this model has a bus signal bus1, composed of the bus elements Clock, Pulse, and Sine.

For complete examples using buses, see Getting Started with Buses.

Virtual and Nonvirtual Buses

A bus can be either virtual or nonvirtual. Virtual and nonvirtual buses provide the same visual simplification, but Simulink handles them differently.

BusFunctional EffectSignal StorageGenerated Code
VirtualExists only graphically; has no functional effect.

Each bus element signal occupies its own storage in memory, but the bus signal is not stored in memory.

A block connected to a virtual bus reads inputs and writes outputs by accessing the memory allocated to the component signals. These signals are typically noncontiguous.

Information about the size and data type of signals propagates from the signal sources.

Do not appear in generated code; only the constituent signals appear.
NonvirtualCan have functional effects.

Bus signal occupies its own storage in contiguous memory.

A block connected to a nonvirtual bus reads inputs and writes outputs by accessing copies of the component signals. The copies are maintained in a contiguous area of memory allocated to the bus.

Appear as structures in generated code.

When you simulate or update diagram a model that contains buses, Simulink uses different line styles for virtual and nonvirtual bus signals.

Virtual Bus
Nonvirtual Bus

Bus Objects

A bus can have an associated bus object, which provides bus properties that Simulink uses to validate the bus signal. Bus objects are optional for virtual buses, but required for nonvirtual buses.

A bus object is an instance of class Simulink.Bus that can be in stored in a location such as the base workspace. The object defines the structure of the bus and the properties of its elements, such as nesting, data type, and size. See When to Use Bus Objects for more information. You can create bus objects programmatically or by using the Simulink Bus Editor, which you can use to interactively create and manage bus objects. You can save bus objects as MATLAB code or as a MAT-file. For more information, see Create Bus Objects with the Bus Editor.

Generated Code for Buses

For simulation, virtual buses and nonvirtual buses are similar, except that all elements of a nonvirtual bus must have the same sample time. However, the type of bus can make a significant difference in the efficiency, size, and readability of generated code. For an example of this difference, see Generate Code for Buses.

If you intend to generate code for a model that uses buses, for information about the best techniques to use, see Generate Efficient Code for Bus Signals in the Simulink Coder™ documentation.

Buses and Muxes

In the context of a model, do not use bus and mux mixtures. A bus and mux mixture occurs when some blocks treat a signal as a mux, while other blocks treat that same signal as a bus. For information about addressing the resulting issues, see Prevent Bus and Mux Mixtures.

Arrays of Buses

You can combine multiple nonvirtual buses with identical properties into an array of buses. An array of buses is an array whose elements are buses. Each bus object has the same signal name, hierarchy, and attributes for its bus elements. An array of buses is equivalent to an array of structures in MATLAB.

An example of using an array of buses is to model a multi-channel system. You can model all the channels using the same bus object, although each of the channels could have a different value.

For an example of a model that uses an array of buses, open the sldemo_bus_arrays model. In this example, the nonvirtual bus input signals connect to a Vector Concatenate or Matrix Concatenate block that creates an array of bus signals. Here is how the simulated model appears.

The model uses the array of buses with:

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

  • A For Each Subsystem block, to perform iterative processing over each bus in the array

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

See Combine Buses into an Array of Buses.


If all signals in a composite signal have the same type, generally you can use a mux, which is a special type of noncontiguous vector (virtual) vector. If a block or modeling configuration requires a bus, then do not use a mux.

This model has three signals that are input to a Mux block, transmitted as a mux signal to a Demux block, and output as separate signals.

The Mux and Demux blocks are the left and right vertical bars, respectively. To reduce visual complexity, neither block displays a name.

For more information, see Mux Signals.

Concatenated Contiguous Output Signals

You can concatenate input signals of same data type to create contiguous output signal. You can use a Vector Concatenate or Matrix Concatenate block to . The block concatenates the signals at its inputs to create an output signal whose elements reside in contiguous locations in memory.

For example, this model sets the Matrix Concatenate block parameter Concatenate dimension to 2. Inputs are 2-D matrices. The Matrix Concatenate block performs horizontal matrix concatenation and places the input matrices side by side to create the output matrix.

See Also




Related Examples

Was this topic helpful?