MDFDatastore - Datastore for collection of MDF files - MATLAB (original) (raw)
Datastore for collection of MDF files
Description
Use the MDF datastore object to access data from a collection of MDF files.
Creation
Syntax
Description
`mdfds` = mdfDatastore([location](#mw%5Fc7f532df-e3bb-4c18-b27a-d6e7fba70d9c))
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(__,[Name=Value](#namevaluepairarguments),[Name=Value](#namevaluepairarguments),...)
specifies function options and properties of mdfds
using optional name-value pairs.
Input Arguments
Location of MDF datastore files, specified as a string, character vector, cell array, or object.
DsFileSet
object — You can specify aDsFileSet
object. For more information, see matlab.io.datastore.DsFileSet.FileSet
object — You can specifylocation
as aFileSet
object. Specifying the location as aFileSet
object leads to a faster construction time for datastores compared to specifying a path orDsFileSet
object. For more information, see matlab.io.datastore.FileSet.- File path — You can specify a single file path as a character vector or string scalar. You can specify multiple file paths as a cell array of character vectors or a string array.
The path can be relative or absolute, or a URL to a remote server. Thelocation
argument can contain the wildcard character*
. Iflocation
specifies a folder, by default the datastore includes all files in that folder with the extensions.mdf
,.dat
, or.mf4
. You can use theFileExtensions
parameter to limit or expand this list.
Thelocation
as a file path can take one of these forms.Data Location Form Current folder or MATLAB® path To access files in the current folder or MATLAB path, specify the name of the files or folder in location. Include the extension when specifying files.Example: ["myFile2.mf4","myFile3.mf4"]Example: "myDataFolder" Other folders To access files in a folder other than the current folder, specify the full or relative path name inlocation.Example: "C:\myFolder\myFile*.mf4"Example: "\myDataFolder" Remote location To access files in a remote location,location must contain the full path of the files or folder specified as a uniform resource locator (URL) of the form:scheme://_path_to_location_Based on the remote location,scheme can be one of the values in this table. Remote LocationschemeAmazon S3™s3Windows Azure® Blob Storagewasb, wasbsHDFS™hdfsFor more information, see Work with Remote Data.Example: "s3://bucketname/path_to_file/myMdfData/"
Data Types: string
| char
| cell
| DsFileSet
Name-Value Arguments
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
, where Name
is the argument name and Value
is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.
These pairs set file information or object Properties. Allowed options areIncludeSubfolders
, FileExtensions
, and the properties ReadRaw
, ReadSize
,SelectedChannelGroupNumber
, andSelectedChannelNames
.
Before R2021a, use commas to separate each name and value, and enclose Name
in quotes.
Example: SelectedChannelNames="Counter_B4"
Include files in subfolders, specified as a logical. Specifytrue
to include files in each folder and recursively in subfolders.
Example: IncludeSubfolders=true
Data Types: logical
Custom extensions for filenames to include in the MDF datastore, specified as a string, string array, character vector, or cell array of character vectors. By default, the supported extensions include .mdf
,.dat
, and .mf4
. If your files have custom or nonstandard extensions, use this Name-Value setting to include files with those extensions.
Example: FileExtensions=[".myformat1",".myformat2"]
Data Types: char
| cell
Properties
This property is read-only.
All channel groups present in first MDF file, returned as a table of the same format returned by the mdfChannelGroupInfo function.
Data Types: table
This property is read-only.
All channels present in first MDF file, returned as a table of the same format returned by the mdfChannelInfo function.
Those channels targeted for reading must have the same name and belong to the same channel group in each file of the MDF datastore.
Data Types: table
Files included in the datastore, specified as a character vector, string, or cell array.
Example: ["file1.mf4","file2.mf4"]
Data Types: char
| string
| cell
Read raw data values, specified as true
orfalse
. If specified true
, data are read as raw values. If specified false
, data are read as physical values. The default value is false
.
Example: ReadRaw=true
Data Types: logical
Size of data returned by the read
function, specified as"file"
, a numeric value, or a duration. A string 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 later change the ReadSize
property value type, the datastore resets.
Example: 50
Data Types: double
| string
| char
| duration
Channel group to read, specified as a numeric scalar value.
Example: 1
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Names of channels to read, specified as a string, string array, character vector, or cell array.
Those channels targeted for reading must have the same name and belong to the same channel group in each file of the MDF datastore. Unless specified otherwise, the default value is the channel names in channel group 1 sorted in alphabetical order.
Example: "Counter_B4"
Data Types: char
| string
| cell
Object Functions
Examples
Create an MDF datastore from the sample fileCANape.MF4
, and read it into a timetable.
mdfds = mdfDatastore("C:\myMDFData\CANape.MF4"); while hasdata(mdfds) m = read(mdfds); end
Version History
Introduced in R2017b
Because of the new mdfRead
workflow underlying themdfDatastore
functionality, the Conversion
name-value pair argument is no longer supported. Code that uses this option generates an error. Instead, you can use the ReadRaw
property and name-value argument.
Minor corresponding updates of data types and formats are also made to theReadSize
, Channels
,ChannelGroups
, and SelectedChannelNames
properties.
You can directly access MDF file data stored at remote locations, including Amazon S3, Azure® Blob Storage, and HDFS.