Package: Simulink.Bus

Save bus objects in MATLAB file


example saves all bus objects (instances of Simulink.Bus class) that are in the MATLAB® base workspace in a MATLAB file that contains a cell array of cell arrays. Each subordinate cell array represents a bus object and contains this data:

  • Bus name

  • Header file

  • Description

  • Data scope

  • Alignment

  • Elements

The elements field is an array containing this data for each element:

  • Element name

  • Dimensions

  • Data type

  • Sample time

  • Complexity

  • Dimensions mode

  • Minimum

  • Maximum

  • Units

  • Description

example,format) saves the bus objects in a MATLAB file that contains either a cell array of bus information or the bus objects themselves.

example,format,busNames) saves only those bus objects whose names appear in busNames.


collapse all

Use the function to save a bus object.

Define a cell array of bus object information.

busCell = { ...
        { ...
            'myBusObj', ...       
            'MyHeader.h', ...     
            'My description', ... 
            'Exported', ...       
            '-1', ...             
            {{'a',1,'double',[0.2 0],'real','Frame'}; ...
            {'b',1,'double',[0.2 0],'real','Sample'}},...
            }, ...

Create myBusObj bus object from the cell array.


Save the bus object in the BusCellFile1 file, in cell format.

fileName = 'BusCellFile1';;

Save the bus object in bus format.'BusObjFile','object');

Save myBusObj in cell format in BusCellFile2.m.'BusCellFile2','cell',{'myBusObj'});

Input Arguments

collapse all

File in which to store bus objects, specified as a character vector.

Format for storing bus objects in file, specified as either 'cell' or 'object'. The cell format is more compact, but the object format is easier to read.

Bus objects to save, specified as a cell array of bus objects. Only the specified bus objects in the base workspace are saved.


Executing a MATLAB file created by in cell array format calls Simulink.Bus.cellToObject to recreate the bus objects and returns the new bus objects in the cell array. To suppress the creation of bus objects, specify the optional argument 'false' when you execute the MATLAB file.

Compatibility Considerations

expand all

Not recommended starting in R2019b

Introduced before R2006a