Main Content

Get Started with MDF Files

This example shows you how to access information about an MDF file and its contents.

View File Details

View metadata of an MDF file using mdfInfo by specifying the file name. This sample file was created using Vector CANape™.

fileInfo = mdfInfo("CANapeBasic.MF4")
fileInfo = 
  MDFInfo with properties:

   File Details
                  Name: "CANapeBasic.MF4"
                  Path: "/tmp/Bdoc24b_2725827_3770958/tp7650169a/vnt-ex51113426/CANapeBasic.MF4"
                Author: "Otmar Schneider"
            Department: "PMC @ Vector Informatik GmbH"
               Project: "Demo"
               Subject: "XCPSim"
               Comment: "Example file created with Vector CANape"
               Version: "4.10"
      InitialTimestamp: 2016-04-21 14:27:17.000010630

   Creator Details
     ProgramIdentifier: "MCD14.02"
     CreatorVendorName: "Vector Informatik GmbH"
       CreatorToolName: "CANape"
    CreatorToolVersion: "14.0.20.2386"
       CreatorUserName: "visosr"
        CreatorComment: "created"

   File Contents
            Attachment: [0x7 table]
     ChannelGroupCount: 2
                 Event: [0x8 eventtable]

Basic details about the MDF file are available as properties under section File Details.

Information about the originating tool of the MDF file is available under section Creator Details.

Under section File Contents, information about the attachments and channel groups within the file is available.

View Channel Group Details

Data in an MDF file is stored in channels contained within channel groups. This sample file contains two channel groups, as seen in the ChannelGroupCount property.

fileInfo.ChannelGroupCount
ans = uint64

2

View details about the two channel groups in this MDF file using mdfChannelGroupInfo.

chanGrpInfo = mdfChannelGroupInfo("CANapeBasic.MF4")
chanGrpInfo=2×13 table
    GroupNumber    AcquisitionName    Comment    NumSamples    DataSize    Sorted    SourceName     SourcePath    SourceComment    SourceType    SourceBusType    SourceBusChannelNumber    SourceSimulated
    ___________    _______________    _______    __________    ________    ______    ___________    __________    _____________    __________    _____________    ______________________    _______________

         1              10 ms          10 ms        1993        153461     true      <undefined>      XCPsim       <undefined>        ECU             CAN                   1                    false     
         2              100ms          100ms         199         23084     true      <undefined>      XCPsim       <undefined>        ECU             CAN                   1                    false     

View Channel Details

View details about all the channels in this MDF file using mdfChannelInfo.

chanInfoDefault = mdfChannelInfo("CANapeBasic.MF4")
chanInfoDefault=42×13 table
                     Name                     GroupNumber    GroupNumSamples    GroupAcquisitionName    GroupComment    GroupSourceName    GroupSourcePath    DisplayName       Unit                             Comment                         ExtendedNamePrefix    SourceName     SourcePath
    ______________________________________    ___________    _______________    ____________________    ____________    _______________    _______________    ___________    ___________    _________________________________________________    __________________    ___________    __________

    "Counter_B4"                                   1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Single bit demo signal (bit from a byte shifting)          XCPsim          <undefined>      XCPsim  
    "Counter_B5"                                   1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Single bit demo signal (bit from a byte shifting)          XCPsim          <undefined>      XCPsim  
    "Counter_B6"                                   1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Single bit demo signal (bit from a byte shifting)          XCPsim          <undefined>      XCPsim  
    "Counter_B7"                                   1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Single bit demo signal (bit from a byte shifting)          XCPsim          <undefined>      XCPsim  
    "PWM"                                          1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Pulse width signal from PWM_level and Triangle             XCPsim          <undefined>      XCPsim  
    "PWMFiltered"                                  1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Low pass filtered PWM signal                               XCPsim          <undefined>      XCPsim  
    "PWM_Level"                                    1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim  
    "Triangle"                                     1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Triangle test signal used for PWM output PWM               XCPsim          <undefined>      XCPsim  
    "ampl"                                         2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    Amplitude of channel 1-3                                   XCPsim          <undefined>      XCPsim  
    "channel1"                                     2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    FLOAT demo signal (sine wave)                              XCPsim          <undefined>      XCPsim  
    "map1_8_8_uc_measure"                          1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    8*8 fixed axis,  permanently morphing                      XCPsim          <undefined>      XCPsim  
    "syncArrayStruct.mem_charArray[000]"           2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim  
    "syncArrayStruct.mem_charArray[001]"           2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim  
    "syncArrayStruct.mem_doubleArray[000]"         2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim  
    "syncArrayStruct.mem_doubleArray[001]"         2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim  
    "syncArrayStruct.mem_floatArray[000]"          2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim  
      ⋮

By default, the function returns minimal channel metadata. Specify the AdditionalMetadata option as true to view the additional metadata as well.

chanInfoAdditional = mdfChannelInfo("CANapeBasic.MF4", AdditionalMetadata=true)
chanInfoAdditional=42×25 table
                     Name                     GroupNumber    GroupNumSamples    GroupAcquisitionName    GroupComment    GroupSourceName    GroupSourcePath    DisplayName       Unit                             Comment                         ExtendedNamePrefix    SourceName     SourcePath       Type        SyncType             DataType              NumBits     ComponentType     CompositionType    ConversionType    SourceComment    SourceType    SourceBusType    SourceBusChannelNumber    SourceSimulated
    ______________________________________    ___________    _______________    ____________________    ____________    _______________    _______________    ___________    ___________    _________________________________________________    __________________    ___________    __________    ___________    ________    ___________________________    _______    _______________    _______________    ______________    _____________    __________    _____________    ______________________    _______________

    "Counter_B4"                                   1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Single bit demo signal (bit from a byte shifting)          XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerUnsignedLittleEndian       1       None                    None           ValueToText           ""             ECU             CAN                   0                    false     
    "Counter_B5"                                   1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Single bit demo signal (bit from a byte shifting)          XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerUnsignedLittleEndian       1       None                    None           ValueToText           ""             ECU             CAN                   0                    false     
    "Counter_B6"                                   1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Single bit demo signal (bit from a byte shifting)          XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerUnsignedLittleEndian       1       None                    None           ValueToText           ""             ECU             CAN                   0                    false     
    "Counter_B7"                                   1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Single bit demo signal (bit from a byte shifting)          XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerUnsignedLittleEndian       1       None                    None           ValueToText           ""             ECU             CAN                   0                    false     
    "PWM"                                          1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Pulse width signal from PWM_level and Triangle             XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerUnsignedLittleEndian       8       None                    None           ValueToText           ""             ECU             CAN                   0                    false     
    "PWMFiltered"                                  1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Low pass filtered PWM signal                               XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerUnsignedLittleEndian       8       None                    None           Unspecified           ""             ECU             CAN                   0                    false     
    "PWM_Level"                                    1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerSignedLittleEndian         8       None                    None           Unspecified           ""             ECU             CAN                   0                    false     
    "Triangle"                                     1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Triangle test signal used for PWM output PWM               XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerSignedLittleEndian         8       None                    None           Unspecified           ""             ECU             CAN                   0                    false     
    "ampl"                                         2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    Amplitude of channel 1-3                                   XCPsim          <undefined>      XCPsim      FixedLength      None      RealLittleEndian                 32       None                    None           Unspecified           ""             ECU             CAN                   0                    false     
    "channel1"                                     2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    FLOAT demo signal (sine wave)                              XCPsim          <undefined>      XCPsim      FixedLength      None      RealLittleEndian                 32       None                    None           Unspecified           ""             ECU             CAN                   0                    false     
    "map1_8_8_uc_measure"                          1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    8*8 fixed axis,  permanently morphing                      XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerUnsignedLittleEndian       8       None                    Array          Unspecified           ""             ECU             CAN                   0                    false     
    "syncArrayStruct.mem_charArray[000]"           2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerSignedLittleEndian         8       StructureMember         None           Unspecified           ""             ECU             CAN                   0                    false     
    "syncArrayStruct.mem_charArray[001]"           2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim      FixedLength      None      IntegerSignedLittleEndian         8       StructureMember         None           Unspecified           ""             ECU             CAN                   0                    false     
    "syncArrayStruct.mem_doubleArray[000]"         2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim      FixedLength      None      RealLittleEndian                 64       StructureMember         None           Unspecified           ""             ECU             CAN                   0                    false     
    "syncArrayStruct.mem_doubleArray[001]"         2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim      FixedLength      None      RealLittleEndian                 64       StructureMember         None           Unspecified           ""             ECU             CAN                   0                    false     
    "syncArrayStruct.mem_floatArray[000]"          2               199                 100ms               100ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                                XCPsim          <undefined>      XCPsim      FixedLength      None      RealLittleEndian                 32       StructureMember         None           Unspecified           ""             ECU             CAN                   0                    false     
      ⋮

Find Channels in an MDF File

mdfChannelInfo can also be used to easily query for channel details within an MDF file if the name is fully or partially known. The function offers an option Channel that supports wildcards for string matching.

To find channels with name being exactly "PWM":

pwmChanInfoExact = mdfChannelInfo("CANapeBasic.MF4", Channel="PWM")
pwmChanInfoExact=1×13 table
    Name     GroupNumber    GroupNumSamples    GroupAcquisitionName    GroupComment    GroupSourceName    GroupSourcePath    DisplayName       Unit                           Comment                        ExtendedNamePrefix    SourceName     SourcePath
    _____    ___________    _______________    ____________________    ____________    _______________    _______________    ___________    ___________    ______________________________________________    __________________    ___________    __________

    "PWM"         1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Pulse width signal from PWM_level and Triangle          XCPsim          <undefined>      XCPsim  

To find channels whose name contains a substring "PWM":

pwmChanInfoWildcards = mdfChannelInfo("CANapeBasic.MF4", Channel="*PWM*")
pwmChanInfoWildcards=3×13 table
        Name         GroupNumber    GroupNumSamples    GroupAcquisitionName    GroupComment    GroupSourceName    GroupSourcePath    DisplayName       Unit                           Comment                        ExtendedNamePrefix    SourceName     SourcePath
    _____________    ___________    _______________    ____________________    ____________    _______________    _______________    ___________    ___________    ______________________________________________    __________________    ___________    __________

    "PWM"                 1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Pulse width signal from PWM_level and Triangle          XCPsim          <undefined>      XCPsim  
    "PWMFiltered"         1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    Low pass filtered PWM signal                            XCPsim          <undefined>      XCPsim  
    "PWM_Level"           1              1993                 10 ms               10 ms          <undefined>          XCPsim             ""         <undefined>    <undefined>                                             XCPsim          <undefined>      XCPsim