The Dataset logging format
Did you notice the new Dataset logging format available in R2011a?
This new format offers a lot of advantages over the old ModelDataLogs format. Here are a few examples.
Timeseries format
The Dataset format uses MATLAB timeseries objects to store logged data. This allows you to work with logged data in MATLAB without checking out a Simulink license. This also allows you to manipulate the logged data easily using the timeseries methods, like filter, detrend and resample.
The first thing to do when your simulation is completed is to look at the signal logged in the Dataset object. In this example we, kept the default name for this variable: logsout.
logsout
logsout = Simulink.SimulationData.Dataset Package: Simulink.SimulationData Characteristics: Name: 'logsout' Total Elements: 2 Elements: 1: 'x1' 2: 'x2' Use getElement to access elements by index, name or block path.
If I want to see what x2 look like, I can use the timeseries plot command to quickly observe it:
plot(logsout.getElement('x2').Values)
Logging multiple data values for a given time step
With this feature, you can now log everything happening inside blocks like iterator subsystems and Stateflow charts.
If I have this model:
We can see that the data logged inside the For Iterator Subsystem is different from the one logged outside.
This is also very useful for debugging. I already used it to analyze the behavior of multiple Data Store Write blocks writing to the same memory address during one time step.
Simplified access to large-scale simulation data
The Dataset format makes it easier to analyze data from models with deep hierarchies, bus signals, and signals with duplicate or invalid names.
As shown by the examples in the documentation for Simulink.SimulationData.Dataset, you can use the getElement method to access individual elements in the Dataset. You can specify an element by index, name, or block path.
Bug Fixes
A number of bugs affecting the ModelDataLogs format are fixed by the new Dataset format. Look at Bug Report 495436 for more details.
Now it's your turn
Give a try to the new Dataset format and let us know what you think by leaving a comment here.
评论
要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。