This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Simulink.Bus.objectToCell

Use bus objects to create cell array containing bus information

Syntax

cells = Simulink.Bus.objectToCell(busNames)
cells = Simulink.Bus.objectToCell(busNames,scope)

Description

example

cells = Simulink.Bus.objectToCell(busNames) creates a cell array of bus information from a set of 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) specifies whether the bus objects reside in the MATLAB base workspace or a data dictionary.

Examples

collapse all

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

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

open_system(fullfile(matlabroot,'examples','simulink',...
    '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 =

  1x6 cell array

    {'CONTROL'}    {0x0 char}    {0x0 char}    {'Auto'}    {'-1'}    {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 or the MATLAB base workspace, specified as a character vector. If scope is empty, the function uses the base workspace.

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

Output Arguments

collapse all

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

  1. Bus name

  2. Header file

  3. Description

  4. Data scope

  5. Alignment

  6. Elements

The elements field is an array that contains this data for each bus element:

  1. Bus element name

  2. Dimensions

  3. Data type

  4. Sample time

  5. Complexity

  6. Sampling mode

The elements field also contains this data if available:

  1. Dimensions mode

  2. Minimum

  3. Maximum

  4. Units

  5. Description

Tips

The inverse function is Simulink.Bus.cellToObject.

Compatibility Considerations

expand all

Not recommended starting in R2016b

Introduced in R2007a