|On this page…|
You can store bus object objects in a variety of ways.
|Format||When to Use|
In a data dictionary
For large model componentization
As a MATLAB® code file
For traceability and model differencing using MATLAB code
As a MATLAB data file (MAT-file)
For faster bus loading and saving
In a database or other external data source
For comparing bus interface information with design documents stored in an external data source.
You can use the Model Explorer to create a new data dictionary that includes bus objects and link it to a model. For details, see Migrate Single Model to Use Dictionary.
You can read and save bus data with MATLAB code files.
To save all bus objects (instances of the Simulink.Bus class) in the MATLAB base workspace to a MATLAB code file, use one of the following approaches:
From the MATLAB command line, use the Simulink.Bus.save command.
To save variables from the base workspace to a MATLAB code file, use the Simulink.saveVars command. The file containing the variables is formatted to be easily understood and editable. Running the file restores the saved variables to the base workspace.
For traceability, consider using a clearly named separate file for each model.
You can load bus objects in MATLAB data files (MAT-files), using one of the following approaches:
From the MATLAB command line, use the load command.
Loading large data from MAT-files is faster than loading from MATLAB code files.
You can capture bus interface information in a database or other external source, and use scripts and Database Toolbox™ functionality to read that information into MATLAB.
You can use sl_customization.m to customize the Bus Editor to import bus data from a database or other external source. For details, see Customize Bus Object Import and Export.