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. A Simulink® bus is not analogous to a hardware bus, such as the bus in computer hardware architecture. Simulink software implements a bus as a name-based hierarchical structure of signals.

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 Buses at Model Reference Interfaces.

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

For complete examples using buses, see slexBusExample and 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, even when associated with a test point. 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 perform an update diagram operation for a model that contains buses, Simulink uses different line styles for virtual and nonvirtual bus signals.

Virtual Bus
Nonvirtual Bus

A Signal Conversion block can convert a virtual bus to a nonvirtual bus or a nonvirtual bus to a virtual 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 specifies only the architectural properties of a bus, as distinct from the values of the signals it contains. For example, a bus object can specify the number of elements in a bus, the order of those elements, whether and how elements are nested, and the data types of constituent signals; but not the signal values. A bus object is analogous to a structure definition in C: it defines the members of the bus but does not create a bus. Another way of thinking of a bus object is that it is similar to a cable connector. The connector defines all the pins and their configuration and controls what types of wires can be connected to it. Similarly, a bus object defines the configuration and properties of the signals that the associated bus must have.

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. You can create bus objects programmatically or by using the Simulink Bus Editor, which you can use to create and manage bus objects interactively. You can save bus objects as MATLAB® code or as a MAT-file. For more information, see When to Use Bus Objects and 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 (Simulink Coder).

Bus Element Ports

The In Bus Element and Out Bus Element blocks provide a simplified and flexible way to use bus signals as inputs and outputs to subsystems. Here is model that uses bus element port blocks.

You can refactor a subsystem interface that uses Inport, Bus Selector, Bus Creator, and Outport blocks to use In Bus Element and Out Bus Element blocks. Conversion operations are supported only when the signal lines or blocks do not have any extra specification. You can use single-click operations to:

  • Convert Inport and Bus Selector blocks in a subsystem to In Bus Element blocks.

  • Convert Outport and Bus Creator blocks in a subsystem to Out Bus Element blocks.

  • Transform input or output interfaces of subsystems to use bus element port blocks.

See slexBusExample and Simplify Subsystem Bus Interfaces.

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 (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.

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 concatenate 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 Topics