Documentation

Simulink.Bus.save

Save bus objects in MATLAB file

Syntax

Simulink.Bus.save(fileName)
Simulink.Bus.save(fileName,format)
Simulink.Bus.save(fileName,format,busNames)

Description

example

Simulink.Bus.save(文件名)saves all bus objects (instances ofSimulink.Busclass) 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

Simulink.Bus.save(文件名,format)saves the bus objects in a MATLAB file that contains either a cell array of bus information or the bus objects themselves.

example

Simulink.Bus.save(文件名,format,busNames)saves only those bus objects whose names appear inbusNames.

Examples

collapse all

Use theSimulink.Bus.savefunction 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'}},...},...};

CreatemyBusObjbus object from the cell array.

Simulink.Bus.cellToObject(busCell);

Save the bus object in theBusCellFile1file, in cell format.

文件名='BusCellFile1'; Simulink.Bus.save(fileName);

Save the bus object in bus format.

Simulink.Bus.save('BusObjFile','object');

SavemyBusObjin cell format inBusCellFile2.m.

Simulink.Bus.save('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.

Tips

Executing a MATLAB file created bySimulink.Bus.savein cell array format callsSimulink.Bus.cellToObjectto 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.

Introduced before R2006a

Was this topic helpful?