Using MDF Files Via MDF Datastore

This example shows you how to use the MDF Datastore feature of Vehicle Network Toolbox to quickly and efficiently process a data set spread across a collection of multiple MDF files. This workflow is also valuable when there is too much data to fit into available memory.

Configure the MDF Datastore

Multiple options allow control of what data is read from the MDF files and how the reads are performed. In this case, the first channel group is used by default. Note that only one channel group may be selected by the datastore at a time. You can also specify certain channels within the selected channel group to read. In this case, all channels are read by default.

Using MDF Datastore readall

You can use the readall function to read the entire contents of data in a single call. This is an efficient way to read from many files when the data set fits into available memory. Aftering readall, the datastore resets to the beginning of the data set.

Using MDF Datastore read

You can use the read function to obtain data from the file set. By default, reads from the MDF datastore will read an entire file's worth of data per call. The power of a datastore comes from reading through multiple files sequentially within the file set. As you read, the datastore automatically bridges from one file to the next until all data from all files is read.

MDF Datastore reset

At any time, you can call the reset function to start over again at the beginning of the data set.

reset(mds)

Configure MDF Datastore read By Data Record

You can use the ReadSize property to specify how much data to read on each call. ReadSize can be specified as a numeric value to read a fixed number of data points. ReadSize lets you control how much data is loaded into memory when you have a data set larger than available memory. We recommend using custom read sizes that are small enough to fit in memory, but still as large as possible to reduce processing overhead and improve performance.