Main Content

Troubleshooting MDF Applications

Error When Creating mdf Object

Issue

You might see an error when you try to create an object for access to the MDF-file with the mdf function.

Possible Solutions

  • A likely cause is an MDF-file that is improperly formatted or that includes unsupported elements. Vector provides an MDF Validator tool for checking an MDF-file. To download the tool visit MDF Validator.

Error When Reading an MDF-File

Issue

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

Possible Solutions

  • A possible cause is an MDF-file that is improperly formatted or that includes unsupported elements. Vector provides an MDF Validator tool for checking an MDF-file. To download the tool visit MDF Validator.

  • 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 read function with the form data = read(mdfObj,chanGroupIndex,chanName)

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 channelList function.

Unable to Save MDF Attachments

Issue

The saveAttachment function fails to save a file attached to the MDF-file.

Possible Solutions

  • The saveAttachment 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
    
        {'Sigend_Int16_LE_Offset_32'}    {'Unsigend_UInt32_LE_Master_Offset_0'}

See Also

Functions

Related Topics

External Websites