Guy and Seth on Simulink
May 14th, 2012
How to Load and Save Bus Signal Data
In R2012a, the From Workspace, To Workspace, From File and To File blocks all support bus signals. This is an often requested capability, and I have been looking forward to it for a long time.
In R2012a, most methods for importing and exporting data to and from a model have been standardized to use MATLAB Timeseries.
For example, if you open the dialog of the To Workspace, you will see that timeseries is now the default save format:
Using MATLAB timeseries offers a lot of advantages as I described in a previous post on the dataset logging format.
Importing Bus Data
Let's say I want to import bus data, I create a structure of timeseries:
Then I specify the name of the variable or file, and the bus object in the From Workspace or From File dialog.
and we have a model importing buses!
Exporting Bus data
To export bus data, all you need to do do is connect the bus signal to a To Workspace or To File block and ensure the block is configured to use timeseries as save format (the default).
Once the data is in the MATLAB Workspace, you can use all timeseries methods to process your data.
For example, I can quickly detrend, filter and plot a random signal "b", contained inside bus "busOut":
Now its your turn
Are you going to include these new methods of loading and saving bus data in your workflow? Which is be best block pair for loading/saving buses? Let us know by leaving a comment here
Leave a Reply