Main Content

Simulink.Bus.objectToCell

Use Simulink.Bus objects to create cell array containing bus information

Description

example

cells = Simulink.Bus.objectToCell(busNames) creates a cell array of bus information from a set of Simulink.Bus objects in the MATLAB® base workspace. The cell array contains subordinate cell arrays that define each Bus object. The order of elements in the output cell array corresponds to the order of names in the input cell array.

cells = Simulink.Bus.objectToCell(busNames,scope) creates a cell array of bus information from a set of Bus objects in the data dictionary specified by scope. The cell array contains subordinate cell arrays that define each Bus object. The order of elements in the output cell array corresponds to the order of names in the input cell array.

Examples

collapse all

Use the Simulink.Bus.objectToCell function to create a cell array of information about Simulink.Bus objects in the base workspace.

Open a model that has two Bus objects defined, CONTROL and MAIN.

open_system('ex_bus_object_tutorial_using_objects')

Create a cell array of information about the CONTROL Bus object.

cells = Simulink.Bus.objectToCell({'CONTROL'});
cells{1}
ans=1×7 cell array
    {'CONTROL'}    {0x0 char}    {0x0 char}    {'Auto'}    {'-1'}    {'0'}    {2x1 cell}

Input Arguments

collapse all

Bus objects for which to create cell arrays of Bus object information, specified as a cell array. Specify the Bus object names as character vectors. If busNames is empty, the function converts all Bus objects in the base workspace or data dictionary.

Example: cells = Simulink.Bus.objectToCell({'busObject'})

Data dictionary, specified as a Simulink.data.Dictionary object. Before you use this argument, represent the dictionary with a Simulink.data.Dictionary object by using, for example, the Simulink.data.dictionary.create or Simulink.data.dictionary.open function.

If scope is empty, the function uses the MATLAB base workspace as the source of the Bus objects.

Example: cells = Simulink.Bus.objectToCell({'busObject'},dataDictionaryObject)

Output Arguments

collapse all

Bus object information, specified as a cell array of cell arrays. Each subordinate cell array contains these Bus object properties:

  1. Bus name

  2. Header file

  3. Description

  4. Data scope

  5. Alignment

  6. Preserve Element Dimensions

  7. Elements

The elements field is a cell array that contains this information for each of the Simulink.BusElement objects that the Bus object references:

  1. Bus element name

  2. Dimensions

  3. Data type

  4. Sample time — The cell array contains this field when the sample time is not inherited. A noninherited sample time causes an error during model compilation. For more information, see Simulink.BusElement objects no longer support the SampleTime property.

  5. Complexity

  6. Sampling mode

  7. Dimensions mode

  8. Minimum

  9. Maximum

  10. Units

  11. Description

Tips

The inverse function is Simulink.Bus.cellToObject.

Version History

Introduced in R2007a

expand all