Main Content

Bus Editor

Create, modify, and manage bus objects


The Bus Editor lets you interactively create, modify, and manage Simulink.Bus and Simulink.ConnectionBus objects and the Simulink.BusElement or Simulink.ConnectionElement objects that they contain.

The Sources pane provides available sources, which are the MATLAB® base workspace and open data dictionaries. The objects that you create are stored in the selected source. In the toolstrip, you can create or open a data dictionary. You can also import objects defined by a MAT file, function, or script into the base workspace.

An interactive table displays information about the objects, such as hierarchy and properties. You can select which columns appear in the table by using the Columns list in the toolstrip. Use the table to:

  • Filter contents — Enter a universal filter or a column-specific filter.

  • Change values — Double-click a value in the table and enter a new value. Edit the properties of a bus object and its elements at the top level, not where the bus object is specified as a data type.

  • Reorder elements — Drag the elements to a new position or use the Move Up and Move Down buttons in the toolstrip.

  • Cut, copy, and paste elements — Use keyboard shortcuts or the corresponding buttons in the toolstrip.

  • Delete elements — Press the Delete key or click the Delete button in the toolstrip. When you delete a bus object, you also delete the element objects it contains. Update any blocks that specify the deleted object. To find where a bus object is used in a model, see Finding Blocks That Use a Specific Variable.

In the table, you can edit multiple selected objects of the same type at the same time.

The Property Inspector pane lets you focus on one object at a time and edit its properties. When you enter a value that is not supported, a diagnostic message appears in this pane.


The Bus Editor does not support undo or redo actions. Changes that create, reorder, or delete objects take effect immediately in the base workspace.

The Bus Editor can export object definitions to a MAT file (.mat) or function (.m). It can also create a MATLAB structure or Simulink.Parameter object from a Simulink.Bus object. You can find these actions in the Share section of the toolstrip.

Open the Bus Editor

  • Simulink® Toolstrip: On the Modeling tab, in the Design gallery, click Bus Editor.

  • MATLAB Command Window: Enter buseditor.

  • Model Explorer: In a bus object dialog box, click Launch Bus Editor.


expand all

Suppose you want to define an interface for a model with a Simulink.Bus object. For this example, the interface receives signals named sine, chirp, constant, pulse, and saw. You want the interface to group all the signals. Within that group, you want the interface to group the sinusoidal and nonsinusoidal signals.

You can create the objects in the base workspace or a data dictionary. In the Sources pane, select the location to contain the new objects.

  • To create a data dictionary, in the Bus Editor toolstrip, click New. In the dialog box, specify a name for the data dictionary. Then, click Save.

  • To open a data dictionary, in the Bus Editor toolstrip, click Open. In the dialog box, specify the data dictionary that you want to open. Then, click Open.

Create three Simulink.Bus objects.

  1. In the toolstrip, in the Add gallery, click Bus three times to create three Bus objects.

  2. Name the objects interface, sinusoidal, and nonsinusoidal. Double-click each object name in the table and enter the new name or use the Property Inspector pane.

Add Simulink.BusElement objects to the Bus objects.

  1. Select the object named interface, and add three BusElement objects to it. In the toolstrip, click Bus Element three times.

  2. Name the elements constant, sinusoidal_bus, and nonsinusoidal_bus. Double-click each object name in the table and enter the new name or use the Property Inspector pane.

  3. Similarly, select the sinusoidal bus object and add two elements to it named sine and chirp.

  4. Select the nonsinusoidal bus object and add two elements to it named pulse and saw.

Any element in a bus can be another bus, which can in turn contain subordinate buses, to any depth. To mimic this bus hierarchy, a bus-element object can specify a bus object data type.

Nest the Bus objects named sinusoidal and nonsinusoidal in the Bus object named interface.

  1. For the object named sinusoidal_bus, set DataType to Bus: sinusoidal.

  2. For the object named nonsinusoidal_bus, set DataType to Bus: nonsinusoidal.

The object named interface now matches the desired hierarchy for the component interface. To specify the object at a component interface, you can specify it as the data type of In Bus Element, Inport, Out Bus Element, and Outport blocks.

When you create or modify bus objects in the base workspace or a data dictionary, save the objects for future use. If blocks specify these objects, the objects are required for simulation.

The Bus Editor can save bus objects in a MAT file (.mat), MATLAB function (.m), or data dictionary (.sldd).

To save the objects that are in the base workspace:

  1. In the Sources pane, select the base workspace.

  2. In the toolstrip, click the Export button arrow. Then, select one of the options, which create a MAT file or MATLAB function.

    For MATLAB functions, you have the option to save the objects in a compressed cell format or a more readable object format.

  3. In the Export dialog box, specify the file name, then click Save.

Alternatively, cut or copy the objects from the base workspace. Then, paste them in a data dictionary.

To save the objects that are in a data dictionary:

  1. In the Sources pane, select the modified data dictionary.

  2. In the toolstrip, click Save. Alternatively, right-click the data dictionary and select Save changes.

You can use the Bus Editor to manage bus objects from multiple sources.

You can import bus objects from a function, script, or MAT file.

  1. In the toolstrip, click the Import button arrow, then select one of the options.

  2. In the Import into Base Workspace dialog box, select the file that defines the bus objects and click Open.

The import loads the complete contents of the file, not just the bus objects. The table displays the available bus objects in alphabetical order.

You can also open a data dictionary to manage its bus objects.

  1. In the toolstrip, click Open.

  2. In the Open dialog box, select the data dictionary that defines the bus objects and click Open.

Use filters to quickly find bus elements by name or property value. The filter can be a search term or regular expression. For information about regular expressions, see Regular Expressions.

To quickly find elements with a double data type, type double in either the Filter contents box or the Filter by DataType box that appears when you pause on the DataType column heading and click the button that appears. As you type, the table updates dynamically to show only the objects whose names or property values match the filter and their parents. The comparison is not case-sensitive.

You can use the Bus Editor to modify bus objects in the base workspace and data dictionaries.

To edit one or more objects of the same type in the Bus Editor:

  1. Select the objects that you want to update.

    • To select multiple noncontiguous objects, hold Ctrl and select each element.

    • To select multiple contiguous objects, hold Shift and select the first and last element.

    • To select all objects, first select one object. Then, press Ctrl+A.

  2. Double-click the property value that you want to change for all the selected elements that are the same type of object. Then, specify the new value.

    When you commit the new value, the change applies to all the selected objects that are the same type of object.

You can also edit one object at a time in the Property Inspector pane.

To edit an element of a nested bus object, right-click the dimmed element and select Go to to bring you to the editable instance of the element.

To reorder elements, select and drag the elements to a new position or use the Move Up and Move Down buttons in the toolstrip.

You can edit contents in the filtered view just like the unfiltered view. Elements that no longer match the filter disappear from the table. Conversely, if some activity outside the Bus Editor changes a filtered object so that it passes the current filter, the object immediately becomes visible.

Operations affect only the available objects. An object that a filter hides is unaffected by the operation. To act on all available objects, clear the filter.

You can use the Bus Editor to create MATLAB structures for initialization.

Suppose you have a Simulink.Bus object named MyData that contains two elements named temperature and pressure.

  • temperature — Signal with a data type of int16

  • pressure — Nested array of buses with a data type of Bus: PressureBus and dimensions specified as [1 3]

The nested Bus object named PressureBus has two elements named s1 and s2.

MyData bus object in the Bus Editor

Select the Bus object named MyData. Then, in the toolstrip, click MATLAB Structure.

Specify a name and location for the new MATLAB structure.

The MATLAB structure specifies an initial condition of 0 for each element.

MyData_MATLABStruct = struct;
MyData_MATLABStruct.temperature = int16(0);
MyData_MATLABStruct.pressure = struct;
MyData_MATLABStruct.pressure(1).s1 = 0;
MyData_MATLABStruct.pressure(1).s2 = 0;
MyData_MATLABStruct.pressure(2).s1 = 0;
MyData_MATLABStruct.pressure(2).s2 = 0;
MyData_MATLABStruct.pressure(3).s1 = 0;
MyData_MATLABStruct.pressure(3).s2 = 0;

Optionally, change the initial conditions of the structure elements.

Use the MATLAB structure to specify the Initial condition parameter of a block such as a Unit Delay block.

To create a MATLAB structure for a top-level Bus object that defines an array of buses, use the Simulink.Bus.createMATLABStruct function.


  • A bus object cannot directly or indirectly reference itself. If you define a circular structure, the Bus Editor keeps the original data type of the element that would have completed the circle.

  • Display only the columns that are relevant to you in the Bus Editor. For example, if you do not use Simulink.ConnectionBus objects, in the Bus Editor toolstrip, click Columns and clear Type.

  • When you have a model that creates a bus with a Bus Creator block, you can use the Simulink.Bus.createObject function to create the corresponding objects instead of creating each Simulink.Bus and Simulink.BusElement object individually.

Version History

Introduced before R2006a

expand all