Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mdfDatastore

Datastore for collection of MDF files

Syntax

mdfds = mdfDatastore(location)
mdfds = mdfDatastore(__,'Name1',Value1,'Name2',Value2,...)

Description

example

mdfds = mdfDatastore(location) creates an MDFDatastore based on an MDF file or a collection of files in the folder specified by location. All files in the folder with extensions .mdf, .dat, or .mf4 are included.

mdfds = mdfDatastore(__,'Name1',Value1,'Name2',Value2,...) specifies function options and properties of mdfds using optional name-value pairs.

Examples

collapse all

Create an MDF datastore from the sample file CANape.MF4, and read it into a timetable.

mdfds = mdfDatastore(fullfile(matlabroot,'examples','vnt','CANape.MF4'));
while hasdata(mdfds)
    m = read(mdfds);
end 

Input Arguments

collapse all

Location of MDF datastore files, specified as a character vector or cell array of character vectors, identifying either files or folders. The path can be relative or absolute, and can contain the wildcard character *. If location specifies a folder, the datastore includes by default all files in that folder with extensions .mdf, .dat, or .mf4.

Example: 'CANape.MF4'

Data Types: char | cell

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'SelectedChannelNames','Counter_B4'

collapse all

Include files in subfolders, specified as a logical. Specify true to include files in each folder and recursively in subfolders.

Example: true

Data Types: logical

Custom extensions for filenames to include in the MDF datastore, specified as a character vector or cell array of character vectors. By default, the extensions supported include .mdf, .dat, and .mf4. If your files have custom or nonstandard extentions, use this Name-Value setting to include files with those extentions.

Example: {'.myformat1','.myformat2'}

Data Types: char | cell

Size of data returned by read, specified as 'file', a numeric value, or a duration. A character vector value of 'file' causes the entire file to be read; a numeric double value specifies the number of records to read; and a duration value specifies a time range to read.

If you subsequently change the ReadSize property value type, the datastore resets.

Example: 50

Data Types: double | char | duration

Names of channels to read, specified as a character vector, string, or cell array.

Example: 'Counter_B4'

Data Types: char | string | cell

Channel group to read, specified as a numeric scalar value.

Example: 1

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

MDF datastore returned as an MDFDatastore object, with the following methods and properties.

Method

Purpose
previewRead eight rows from start of datastore (first file), from the selected channel group number and selected channel names
readRead subset of data from datastore
readallRead all data from datastore
hasdataTrue if more data available in datastore
resetReset datastore to start of data
partitionPart of original datastore
numpartitionsEstimate for number of partitions to use
PropertyPurpose
FilesFiles included in datastore
ReadSizeSize of data returned by read
ChannelGroupsAll channel groups present in first MDF file (read-only)
ChannelsAll channels present in first MDF file (read-only)
SelectedChannelGroupNumberChannel group currently selected
SelectedChannelNamesChannels currently selected

See Also

Functions

Introduced in R2017b

Was this topic helpful?