Main Content


Add element to input bus element port

Since R2022b



Simulink.Bus.addElementToPort(component,port,element) adds the specified element to the specified input bus element port of the specified model or subsystem. This function does not add a block to the model or subsystem.


collapse all

Suppose you want to create a model that receives a bus. The input bus contains a bus named sinusoidal, a signal named constant, and a bus named nonsinusoidal. The sinusoidal bus contains signals named sine and chirp. The nonsinusoidal bus contains signals named pulse and saw.

Open a new model named myModel.

model = new_system("myModel");

Add an In Bus Element block to the model. Name the port myBusPort, and specify sine as the element selected by the block. When you specify sine, use dots to indicate the levels of bus hierarchy.

add_block("simulink/Ports & Subsystems/In Bus Element",...
    "myModel/In Bus Element",...

When you do not specify an element for the block to select, by default, the block selects an element named signal1.

Add the remaining elements to the input port that corresponds with the In Bus Element block.


Input Arguments

collapse all

Model name or subsystem block path, specified as a character vector or string scalar.

Data Types: char | string

Input bus element port name, specified as a character vector or string scalar.

Data Types: char | string

New bus element, specified as a character vector or string scalar.

For elements of nested buses, use dots to indicate each level of bus hierarchy. For example, to add a nested bus named sinusoidal with an element named sine, set element to sinusoidal.sine.


To add an element to a bus when a Simulink.Bus object specifies the bus hierarchy, edit the Simulink.Bus object.

Data Types: char | string

Alternative Functionality

In the In Bus Element block dialog box, click the Add element button arrow. Then, select Add element without block.

Version History

Introduced in R2022b

expand all