Main Content

Troubleshooting MDF Applications

Error When Reading an MDF File

Issue

You might see an error when you try to read data from an MDF file with the mdfRead function.

Possible Solutions

  • A possible cause is an MDF file that is improperly formatted or that includes unsupported elements. For checking an MDF file, Vector provides an MDF Validator tool, which you can download from Tool Support MDF.

  • Another possible cause is an unsorted MDF file. Beginning in R2019b, accessing an unsorted MDF file generates a recognizable error, and you can sort the file using the mdfSort function.

  • When unable to read the entire file, you can read data one channel at a time. Use the mdfRead function with the form

    data = mdfRead("MDFFile.mf4",Channel="Chan-Name")

Error When Reading an MDFDatastore

Issue

You might see an error when you try to read data from an MDFDatastore with the read function.

Possible Solutions

  • Those channels targeted for reading must have the same name and belong to the same channel group in each file of the MDF datastore. Assure uniformity across the MDF files in the database for the channels you are reading.

Unable to Find Specific Channel

Issue

You might be unable to find and read a channel of interest in the MDF file.

Possible Solutions

  • To identify channels in the MDF file, use the mdfChannelInfo function.

Unable to Save MDF Attachments

Issue

The mdfSaveAttachment function fails to save a file attached to the MDF file.

Possible Solutions

  • The mdfSaveAttachment function works only with embedded attachments; external files are not saved because they are already on disk.

  • If the attachment does not exist, check with the provider of the MDF file.

Unable to Read Array Channel Structures

Issue

Vehicle Network Toolbox™ does not support array channel structures.

Possible Solutions

  • To read these channels, you must write a composition function to repackage the data.

Unable to Read MIME and CANopen Data

Issue

Reading MDF file channels with MIME or CANopen data generates an error.

Possible Solutions

  • MIME and CANopen data are not supported by Vehicle Network Toolbox.

Table Column Names Do Not Match Channel Names

Issue

When reading an MDF file, the column names of the output timetable correspond to the channel names in the file, but they might not be identical. Table column names must be compliant with MATLAB variable names, so they are altered to limit their size and characters. Most unsupported characters are converted to underscores.

Possible Solutions

  • The returned timetable preserves the ordering of the channels. So you can access data in the table with numerical indexing.

  • The original names of the channels are embedded in the timetable properties. For example:

    m = mdf('File01.mf4');
    tt = read(m);
    t1 = tt{1};
    t1.Properties.VariableDescriptions
    ans =
    
      1×2 cell array
    
        {'Signed_Int16_LE_Offset_32'}    {'Unsigned_UInt32_LE_Primary_Offset_0'}

See Also

Functions

Related Topics

External Websites