This example shows how to create and use a cell array to generate Simulink.Bus
objects in the base workspace.
To define the elements that the Simulink.Bus
object contains, create an array of Simulink.BusElement
objects or a cell array of the property values for the Simulink.BusElement
objects.
When you define the elements in an array, specify the values that differ from the default.
When you define the elements in a cell array of property values, specify the element name, dimensions, data type, complexity, and sampling mode. Optionally, specify the dimensions mode, minimum, maximum, units, and description.
In this example, elementsArray
and elementsCellArray
create identical Simulink.BusElement
objects.
To create multiple Simulink.Bus
objects at once, create a cell array with two subordinate cell arrays that define the Simulink.Bus
objects. For each Simulink.Bus
object, specify the bus name, header file, description, data scope, alignment, preservation of element dimensions, and elements.
Create the Simulink.Bus
objects in the base workspace from the cell array of cell arrays.
To compare the Simulink.Bus
objects, open the Type Editor.
The Simulink.Bus
objects are identical other than their names.