Main Content

getNumLeafBusElements

Number of leaf elements in Simulink.Bus object

Description

getNumLeafBusElements(busObj) returns the number of leaf elements in the specified Simulink.Bus object.

A leaf element of a bus object is any element of the bus object that is not defined by another bus object. For example, a signal or message can be a leaf element of a bus object.

Examples

collapse all

Load a bus object into the base workspace by running the function named busObjectDefinition.

busObjectDefinition

The top-level bus object, named TopBus, defines a signal named Step and a nested bus object. The nested bus object defines two signals: Chirp and Sine.

Get the number of leaf elements in TopBus.

num = getNumLeafBusElements(TopBus)
num = 
3

TopBus has three leaf elements: Step, Chirp, and Sine.

Input Arguments

collapse all

Bus definition, specified as a Simulink.Bus object. The top-level bus object and each nested bus object must be in the base workspace.

Tips

Use the getNumLeafBusElements function to determine the number of MATLAB® timeseries objects needed to create a structure of timeseries objects from a bus.

Version History

Introduced in R2010b