Main Content

Customize Metadata When Writing Timetable Data to MDF Files

This example shows how to customize the file, channel group, and channel metadata when writing timetable data to an MDF file.

The MAT-file used in this example, MDFTimetables.mat, contains two timetables.

  • Timetable TT1 has variables of numeric data types including uint8, uint16, uint32, uint64, int8, int16, int32, int64, single and double.

  • Timetable TT2 has variables of string and byte array data types including both fixed-length and variable-length data.

In this example, data in TT1 and TT2 are written into channel groups 1 and 2, respectively, of a new MDF file. You should use this advanced workflow if there is a need to customize the metadata when writing to an MDF file.

Before proceeding further in this example, you should first learn about the MDF file structure and the basic workflow demonstrated in example Get Started with Writing Timetable Data to MDF Files.

Load Timetables into Workspace

Load the timetable variables, TT1 and TT2, from MDFTimetables.mat into the workspace.

load("MDFTimetables.mat")

Create a New MDF File with Customized File Metadata

Create an MDFInfo object that contains default file metadata using the function mdfInfo without input argument. Note that the displayed properties represent a subset of file metadata that are settable.

info = mdfInfo
info = 
  MDFInfo with properties:

   File Details
              Author: ""
          Department: ""
             Project: ""
             Subject: ""
             Comment: ""
             Version: "4.20"
    InitialTimestamp: NaT

   Creator Details
     CreatorUserName: ""
      CreatorComment: ""

Set the Author and Comment properties to provide more information about the file.

info.Author = "Alice Author";
info.Comment = "Demonstrate how to set file metadata when creating an MDF file";

Change Version from default to "4.10".

info.Version = "4.10";

Set the CreatorComment property to provide more information about the file creation.

info.CreatorComment = "Created using MATLAB for demonstration";

View the updated MDFInfo object.

info
info = 
  MDFInfo with properties:

   File Details
              Author: "Alice Author"
          Department: ""
             Project: ""
             Subject: ""
             Comment: "Demonstrate how to set file metadata when creating an MDF file"
             Version: "4.10"
    InitialTimestamp: NaT

   Creator Details
     CreatorUserName: ""
      CreatorComment: "Created using MATLAB for demonstration"

Use the function mdfCreate with the option FileInfo to specify the updated file information object. This creates a new skeleton MDF file TimetableAdvanced.mf4 on disk. The updated metadata values are applied for the customized fields, while default values are applied for the other fields.

mdfCreate("TimetableAdvanced.mf4", FileInfo=info)
ans = 
"/tmp/Bdoc24b_2725827_3770958/tp7650169a/vnt-ex42503333/TimetableAdvanced.mf4"

Examine the File Metadata

To confirm that the created MDF file has the correct file metadata, call mdfInfo again with the MDF file name specified, and examine the returned object.

info1 = mdfInfo("TimetableAdvanced.mf4")
info1 = 
  MDFInfo with properties:

   File Details
                  Name: "TimetableAdvanced.mf4"
                  Path: "/tmp/Bdoc24b_2725827_3770958/tp7650169a/vnt-ex42503333/TimetableAdvanced.mf4"
                Author: "Alice Author"
            Department: ""
               Project: ""
               Subject: ""
               Comment: "Demonstrate how to set file metadata when creating an MDF file"
               Version: "4.10"
      InitialTimestamp: 2024-09-06 03:16:50.000000000

   Creator Details
     ProgramIdentifier: "MATLAB"
     CreatorVendorName: "The MathWorks, Inc."
       CreatorToolName: "MATLAB"
    CreatorToolVersion: "24.2.0.2712019 (R2024b)"
       CreatorUserName: ""
        CreatorComment: "Created using MATLAB for demonstration"

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

Customize Channel Group Metadata and Channel Metadata

The function mdfAddChannelGroupMetadata adds default or inferred channel group metadata and channel metadata to an input timetable as custom properties, and returns the resulting timetable. Use this function to set up default metadata that serves as a basis for further customization.

Add channel group metadata and channel metadata to TT1, and assign the resulting timetable to a new variable, TT1WithMetadata.

TT1WithMetadata = mdfAddChannelGroupMetadata(TT1)
TT1WithMetadata=100×10 timetable
     Time      uint8_data    uint16_data    uint32_data    uint64_data    int8_data    int16_data    int32_data    int64_data    single_data    double_data
    _______    __________    ___________    ___________    ___________    _________    __________    __________    __________    ___________    ___________

    0 sec           0            200            600           1400           -99          -198          -396          -794          -9.8           -19.6   
    0.1 sec         2            204            608           1416           -97          -194          -388          -778          -9.6           -19.2   
    0.2 sec         4            208            616           1432           -95          -190          -380          -762          -9.4           -18.8   
    0.3 sec         6            212            624           1448           -93          -186          -372          -746          -9.2           -18.4   
    0.4 sec         8            216            632           1464           -91          -182          -364          -730            -9             -18   
    0.5 sec        10            220            640           1480           -89          -178          -356          -714          -8.8           -17.6   
    0.6 sec        12            224            648           1496           -87          -174          -348          -698          -8.6           -17.2   
    0.7 sec        14            228            656           1512           -85          -170          -340          -682          -8.4           -16.8   
    0.8 sec        16            232            664           1528           -83          -166          -332          -666          -8.2           -16.4   
    0.9 sec        18            236            672           1544           -81          -162          -324          -650            -8             -16   
    1 sec          20            240            680           1560           -79          -158          -316          -634          -7.8           -15.6   
    1.1 sec        22            244            688           1576           -77          -154          -308          -618          -7.6           -15.2   
    1.2 sec        24            248            696           1592           -75          -150          -300          -602          -7.4           -14.8   
    1.3 sec        26            252            704           1608           -73          -146          -292          -586          -7.2           -14.4   
    1.4 sec        28            256            712           1624           -71          -142          -284          -570            -7             -14   
    1.5 sec        30            260            720           1640           -69          -138          -276          -554          -6.8           -13.6   
      ⋮

Examine the custom properties of the new timetable. Note that the properties ChannelType, ChannelDataType, and ChannelNumBits were inferred by mdfAddChannelGroupMetadata from the data stored in the corresponding timetable variable. The remaining properties were set to default values.

The first three properties displayed are metadata that apply to the entire timetable, and the remaining properties are metadata that apply to each variable. A timetable represents a channel group, and a variable in the timetable represents a channel; then the first three properties represent channel group metadata and the rest of the properties represent channel metadata.

TT1WithMetadata.Properties.CustomProperties
ans = 
CustomProperties with properties:

           ChannelGroupAcquisitionName: ""
                   ChannelGroupComment: ""
                ChannelGroupSourceName: ""
                ChannelGroupSourcePath: ""
             ChannelGroupSourceComment: ""
                ChannelGroupSourceType: Unspecified
             ChannelGroupSourceBusType: Unspecified
    ChannelGroupSourceBusChannelNumber: 0
                    ChannelDisplayName: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                        ChannelComment: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                           ChannelUnit: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                           ChannelType: [FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength]
                       ChannelDataType: [IntegerUnsignedLittleEndian    IntegerUnsignedLittleEndian    IntegerUnsignedLittleEndian    IntegerUnsignedLittleEndian    IntegerSignedLittleEndian    ...    ] (1x10 asam.mdf.ChannelDataType)
                        ChannelNumBits: [8 16 32 64 8 16 32 64 32 64]
                  ChannelComponentType: [None    None    None    None    None    None    None    None    None    None]
                ChannelCompositionType: [None    None    None    None    None    None    None    None    None    None]
                     ChannelSourceName: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                     ChannelSourcePath: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                  ChannelSourceComment: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                     ChannelSourceType: [Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified]
                  ChannelSourceBusType: [Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified]
         ChannelSourceBusChannelNumber: [0 0 0 0 0 0 0 0 0 0]
                     ChannelReadOption: [Missing    Missing    Missing    Missing    Missing    Missing    Missing    Missing    Missing    Missing]

Set the property ChannelGroupComment for the timetable, providing more information about this channel group.

TT1WithMetadata.Properties.CustomProperties.ChannelGroupComment = "This channel group contains numeric data of various types.";

Set the property ChannelComment for each variable in the timetable, providing more information about each channel. You can use either the variable index or the variable name to index into the ChannelComment property.

TT1WithMetadata.Properties.CustomProperties.ChannelComment(1) = "Unsigned 8-bit integer";
TT1WithMetadata.Properties.CustomProperties.ChannelComment(2) = "Unsigned 16-bit integer";
TT1WithMetadata.Properties.CustomProperties.ChannelComment(3) = "Unsigned 32-bit integer";
TT1WithMetadata.Properties.CustomProperties.ChannelComment(4) = "Unsigned 64-bit integer";
TT1WithMetadata.Properties.CustomProperties.ChannelComment("int8_data") = "Signed 8-bit integer";
TT1WithMetadata.Properties.CustomProperties.ChannelComment("int16_data") = "Signed 16-bit integer";
TT1WithMetadata.Properties.CustomProperties.ChannelComment("int32_data") = "Signed 32-bit integer";
TT1WithMetadata.Properties.CustomProperties.ChannelComment("int64_data") = "Signed 64-bit integer";
TT1WithMetadata.Properties.CustomProperties.ChannelComment(9) = "32-bit floating-point number";
TT1WithMetadata.Properties.CustomProperties.ChannelComment(10) = "64-bit floating-point number";

View the updated metadata for the channel group and channels.

TT1WithMetadata.Properties.CustomProperties
ans = 
CustomProperties with properties:

           ChannelGroupAcquisitionName: ""
                   ChannelGroupComment: "This channel group contains numeric data of various types."
                ChannelGroupSourceName: ""
                ChannelGroupSourcePath: ""
             ChannelGroupSourceComment: ""
                ChannelGroupSourceType: Unspecified
             ChannelGroupSourceBusType: Unspecified
    ChannelGroupSourceBusChannelNumber: 0
                    ChannelDisplayName: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                        ChannelComment: ["Unsigned 8-bit integer"    "Unsigned 16-bit integer"    "Unsigned 32-bit integer"    "Unsigned 64-bit integer"    "Signed 8-bit integer"    "Signed 16-bit integer"    ...    ] (1x10 string)
                           ChannelUnit: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                           ChannelType: [FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength]
                       ChannelDataType: [IntegerUnsignedLittleEndian    IntegerUnsignedLittleEndian    IntegerUnsignedLittleEndian    IntegerUnsignedLittleEndian    IntegerSignedLittleEndian    ...    ] (1x10 asam.mdf.ChannelDataType)
                        ChannelNumBits: [8 16 32 64 8 16 32 64 32 64]
                  ChannelComponentType: [None    None    None    None    None    None    None    None    None    None]
                ChannelCompositionType: [None    None    None    None    None    None    None    None    None    None]
                     ChannelSourceName: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                     ChannelSourcePath: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                  ChannelSourceComment: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                     ChannelSourceType: [Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified]
                  ChannelSourceBusType: [Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified    Unspecified]
         ChannelSourceBusChannelNumber: [0 0 0 0 0 0 0 0 0 0]
                     ChannelReadOption: [Missing    Missing    Missing    Missing    Missing    Missing    Missing    Missing    Missing    Missing]

Similarly, add channel group metadata and channel metadata to TT2, and assign the resulting timetable to a new variable TT2WithMetadata.

TT2WithMetadata = mdfAddChannelGroupMetadata(TT2)
TT2WithMetadata=10×4 timetable
    Time     fixed_length_string_data    fixed_length_byte_array_data    variable_length_string_data    variable_length_byte_array_data
    _____    ________________________    ____________________________    ___________________________    _______________________________

    0 sec             "abcd"               {[255 255 255 255 255]}                 "zero"                   {[            255 255]}    
    1 sec             "efgh"               {[     18 35 52 69 86]}                 "one"                    {[     18 35 52 69 86]}    
    2 sec             "ijkl"               {[          0 1 2 3 4]}                 "two"                    {[    0 1 2 3 4 5 6 7]}    
    3 sec             "mnop"               {[          4 3 2 1 0]}                 "three"                  {[          4 3 2 1 0]}    
    4 sec             "qrst"               {[255 254 253 252 251]}                 "four"                   {[        253 252 251]}    
    5 sec             "uvwx"               {[250 249 248 247 246]}                 "five"                   {[250 249 248 247 246]}    
    6 sec             "yzAB"               {[245 244 243 242 241]}                 "six"                    {[245 244 243 242 241]}    
    7 sec             "CDEF"               {[240 239 238 237 236]}                 "seven"                  {[        240 238 236]}    
    8 sec             "GHIJ"               {[235 234 233 232 231]}                 "eight"                  {[        235 233 231]}    
    9 sec             "KLMN"               {[255 255 255 255 255]}                 "nine"                   {[255 255 255 255 255]}    

Examine the custom properties of the new timetable.

TT2WithMetadata.Properties.CustomProperties
ans = 
CustomProperties with properties:

           ChannelGroupAcquisitionName: ""
                   ChannelGroupComment: ""
                ChannelGroupSourceName: ""
                ChannelGroupSourcePath: ""
             ChannelGroupSourceComment: ""
                ChannelGroupSourceType: Unspecified
             ChannelGroupSourceBusType: Unspecified
    ChannelGroupSourceBusChannelNumber: 0
                    ChannelDisplayName: [""    ""    ""    ""]
                        ChannelComment: [""    ""    ""    ""]
                           ChannelUnit: [""    ""    ""    ""]
                           ChannelType: [FixedLength    FixedLength    VariableLength    VariableLength]
                       ChannelDataType: [StringASCII    ByteArray    StringASCII    ByteArray]
                        ChannelNumBits: [40 40 64 64]
                  ChannelComponentType: [None    None    None    None]
                ChannelCompositionType: [None    None    None    None]
                     ChannelSourceName: [""    ""    ""    ""]
                     ChannelSourcePath: [""    ""    ""    ""]
                  ChannelSourceComment: [""    ""    ""    ""]
                     ChannelSourceType: [Unspecified    Unspecified    Unspecified    Unspecified]
                  ChannelSourceBusType: [Unspecified    Unspecified    Unspecified    Unspecified]
         ChannelSourceBusChannelNumber: [0 0 0 0]
                     ChannelReadOption: [Missing    Missing    Missing    Missing]

Set the timetable property ChannelGroupComment, providing more information about this channel group.

TT2WithMetadata.Properties.CustomProperties.ChannelGroupComment = "This channel group contains string and byte array data of both fixed and variable length.";

Set the property ChannelComment for each variable in the timetable, providing more information about each channel.

TT2WithMetadata.Properties.CustomProperties.ChannelComment(1) = "String data where each sample has the same number of characters";
TT2WithMetadata.Properties.CustomProperties.ChannelComment(2) = "Byte array data where each sample has the same number of bytes";
TT2WithMetadata.Properties.CustomProperties.ChannelComment(3) = "String data where samples have varying numbers of characters";
TT2WithMetadata.Properties.CustomProperties.ChannelComment(4) = "Byte array data where samples have varying numbers of bytes";

View the updated metadata for the channel group and channels.

TT2WithMetadata.Properties.CustomProperties
ans = 
CustomProperties with properties:

           ChannelGroupAcquisitionName: ""
                   ChannelGroupComment: "This channel group contains string and byte array data of both fixed and variable length."
                ChannelGroupSourceName: ""
                ChannelGroupSourcePath: ""
             ChannelGroupSourceComment: ""
                ChannelGroupSourceType: Unspecified
             ChannelGroupSourceBusType: Unspecified
    ChannelGroupSourceBusChannelNumber: 0
                    ChannelDisplayName: [""    ""    ""    ""]
                        ChannelComment: ["String data where each sample has the same number of characters"    "Byte array data where each sample has the same number of bytes"    ...    ] (1x4 string)
                           ChannelUnit: [""    ""    ""    ""]
                           ChannelType: [FixedLength    FixedLength    VariableLength    VariableLength]
                       ChannelDataType: [StringASCII    ByteArray    StringASCII    ByteArray]
                        ChannelNumBits: [40 40 64 64]
                  ChannelComponentType: [None    None    None    None]
                ChannelCompositionType: [None    None    None    None]
                     ChannelSourceName: [""    ""    ""    ""]
                     ChannelSourcePath: [""    ""    ""    ""]
                  ChannelSourceComment: [""    ""    ""    ""]
                     ChannelSourceType: [Unspecified    Unspecified    Unspecified    Unspecified]
                  ChannelSourceBusType: [Unspecified    Unspecified    Unspecified    Unspecified]
         ChannelSourceBusChannelNumber: [0 0 0 0]
                     ChannelReadOption: [Missing    Missing    Missing    Missing]

Write Data to MDF File with Customized Channel Group Metadata and Channel Metadata

Now TT1WithMetadata carries the data to be written into channel group 1, and the metadata to be configured for this channel group and its channels. The same is true for TT2WithMetadata.

Using mdfWrite, write the two timetables with customized metadata to the skeleton file TimetableAdvanced.mf4 created in previous steps.

mdfWrite("TimetableAdvanced.mf4", TT1WithMetadata)
mdfWrite("TimetableAdvanced.mf4", TT2WithMetadata)

Examine the Channel Group Metadata

Examine metadata for the two channel groups written to TimetableAdvanced.mf4 using mdfChannelGroupInfo.

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

         1           <undefined>      This channel group contains numeric data of various types.                                      100          5000      true      <undefined>    <undefined>     <undefined>     Unspecified     Unspecified               0                    false     
         2           <undefined>      This channel group contains string and byte array data of both fixed and variable length.        10           340      true      <undefined>    <undefined>     <undefined>     Unspecified     Unspecified               0                    false     

Examine the Channel Metadata

Examine metadata for the channels in channel group 1 using mdfChannelInfo. Specify the AdditionalMetadata option as true to view the additional metadata as well.

chanGrp1Info = mdfChannelInfo("TimetableAdvanced.mf4", GroupNumber=1, AdditionalMetadata=true)
chanGrp1Info=11×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
    _____________    ___________    _______________    ____________________    __________________________________________________________    _______________    _______________    ___________    ___________    ____________________________    __________________    ___________    ___________    ___________    ________    ___________________________    _______    _____________    _______________    ______________    _____________    ___________    _____________    ______________________    _______________

    "Time"                1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         s              <undefined>                        <undefined>        <undefined>    <undefined>    Master           Time      RealLittleEndian                 64           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "double_data"         1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         <undefined>    64-bit floating-point number       <undefined>        <undefined>    <undefined>    FixedLength      None      RealLittleEndian                 64           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "int16_data"          1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         <undefined>    Signed 16-bit integer              <undefined>        <undefined>    <undefined>    FixedLength      None      IntegerSignedLittleEndian        16           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "int32_data"          1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         <undefined>    Signed 32-bit integer              <undefined>        <undefined>    <undefined>    FixedLength      None      IntegerSignedLittleEndian        32           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "int64_data"          1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         <undefined>    Signed 64-bit integer              <undefined>        <undefined>    <undefined>    FixedLength      None      IntegerSignedLittleEndian        64           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "int8_data"           1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         <undefined>    Signed 8-bit integer               <undefined>        <undefined>    <undefined>    FixedLength      None      IntegerSignedLittleEndian         8           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "single_data"         1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         <undefined>    32-bit floating-point number       <undefined>        <undefined>    <undefined>    FixedLength      None      RealLittleEndian                 32           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "uint16_data"         1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         <undefined>    Unsigned 16-bit integer            <undefined>        <undefined>    <undefined>    FixedLength      None      IntegerUnsignedLittleEndian      16           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "uint32_data"         1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         <undefined>    Unsigned 32-bit integer            <undefined>        <undefined>    <undefined>    FixedLength      None      IntegerUnsignedLittleEndian      32           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "uint64_data"         1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         <undefined>    Unsigned 64-bit integer            <undefined>        <undefined>    <undefined>    FixedLength      None      IntegerUnsignedLittleEndian      64           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "uint8_data"          1               100              <undefined>         This channel group contains numeric data of various types.      <undefined>        <undefined>          ""         <undefined>    Unsigned 8-bit integer             <undefined>        <undefined>    <undefined>    FixedLength      None      IntegerUnsignedLittleEndian       8           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     

Similarly, examine the metadata for channels in channel group 2.

chanGrp2Info = mdfChannelInfo("TimetableAdvanced.mf4", GroupNumber=2, AdditionalMetadata=true)
chanGrp2Info=5×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
    _________________________________    ___________    _______________    ____________________    _________________________________________________________________________________________    _______________    _______________    ___________    ___________    _______________________________________________________________    __________________    ___________    ___________    ______________    ________    ________________    _______    _____________    _______________    ______________    _____________    ___________    _____________    ______________________    _______________

    "Time"                                    2               10               <undefined>         This channel group contains string and byte array data of both fixed and variable length.      <undefined>        <undefined>          ""         s              <undefined>                                                           <undefined>        <undefined>    <undefined>    Master              Time      RealLittleEndian      64           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "fixed_length_byte_array_data"            2               10               <undefined>         This channel group contains string and byte array data of both fixed and variable length.      <undefined>        <undefined>          ""         <undefined>    Byte array data where each sample has the same number of bytes        <undefined>        <undefined>    <undefined>    FixedLength         None      ByteArray             40           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "fixed_length_string_data"                2               10               <undefined>         This channel group contains string and byte array data of both fixed and variable length.      <undefined>        <undefined>          ""         <undefined>    String data where each sample has the same number of characters       <undefined>        <undefined>    <undefined>    FixedLength         None      StringASCII           40           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "variable_length_byte_array_data"         2               10               <undefined>         This channel group contains string and byte array data of both fixed and variable length.      <undefined>        <undefined>          ""         <undefined>    Byte array data where samples have varying numbers of bytes           <undefined>        <undefined>    <undefined>    VariableLength      None      ByteArray             64           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     
    "variable_length_string_data"             2               10               <undefined>         This channel group contains string and byte array data of both fixed and variable length.      <undefined>        <undefined>          ""         <undefined>    String data where samples have varying numbers of characters          <undefined>        <undefined>    <undefined>    VariableLength      None      StringASCII           64           None              None           Unspecified           ""          Unspecified     Unspecified               0                    false     

Examine the Data

To verify that data was successfully written to file, read data from both channel groups using mdfRead and examine the results.

data = mdfRead("TimetableAdvanced.mf4")
data=2×1 cell array
    {100x10 timetable}
    { 10x4  timetable}

chanGrp1Data = data{1}
chanGrp1Data=100×10 timetable
         Time      uint8_data    uint16_data    uint32_data    uint64_data    int8_data    int16_data    int32_data    int64_data    single_data    double_data
        _______    __________    ___________    ___________    ___________    _________    __________    __________    __________    ___________    ___________

        0 sec           0            200            600           1400           -99          -198          -396          -794          -9.8           -19.6   
        0.1 sec         2            204            608           1416           -97          -194          -388          -778          -9.6           -19.2   
        0.2 sec         4            208            616           1432           -95          -190          -380          -762          -9.4           -18.8   
        0.3 sec         6            212            624           1448           -93          -186          -372          -746          -9.2           -18.4   
        0.4 sec         8            216            632           1464           -91          -182          -364          -730            -9             -18   
        0.5 sec        10            220            640           1480           -89          -178          -356          -714          -8.8           -17.6   
        0.6 sec        12            224            648           1496           -87          -174          -348          -698          -8.6           -17.2   
        0.7 sec        14            228            656           1512           -85          -170          -340          -682          -8.4           -16.8   
        0.8 sec        16            232            664           1528           -83          -166          -332          -666          -8.2           -16.4   
        0.9 sec        18            236            672           1544           -81          -162          -324          -650            -8             -16   
        1 sec          20            240            680           1560           -79          -158          -316          -634          -7.8           -15.6   
        1.1 sec        22            244            688           1576           -77          -154          -308          -618          -7.6           -15.2   
        1.2 sec        24            248            696           1592           -75          -150          -300          -602          -7.4           -14.8   
        1.3 sec        26            252            704           1608           -73          -146          -292          -586          -7.2           -14.4   
        1.4 sec        28            256            712           1624           -71          -142          -284          -570            -7             -14   
        1.5 sec        30            260            720           1640           -69          -138          -276          -554          -6.8           -13.6   
      ⋮

chanGrp2Data = data{2}
chanGrp2Data=10×4 timetable
        Time     fixed_length_string_data    fixed_length_byte_array_data    variable_length_string_data    variable_length_byte_array_data
        _____    ________________________    ____________________________    ___________________________    _______________________________

        0 sec             "abcd"               {[255 255 255 255 255]}                 "zero"                   {[            255 255]}    
        1 sec             "efgh"               {[     18 35 52 69 86]}                 "one"                    {[     18 35 52 69 86]}    
        2 sec             "ijkl"               {[          0 1 2 3 4]}                 "two"                    {[    0 1 2 3 4 5 6 7]}    
        3 sec             "mnop"               {[          4 3 2 1 0]}                 "three"                  {[          4 3 2 1 0]}    
        4 sec             "qrst"               {[255 254 253 252 251]}                 "four"                   {[        253 252 251]}    
        5 sec             "uvwx"               {[250 249 248 247 246]}                 "five"                   {[250 249 248 247 246]}    
        6 sec             "yzAB"               {[245 244 243 242 241]}                 "six"                    {[245 244 243 242 241]}    
        7 sec             "CDEF"               {[240 239 238 237 236]}                 "seven"                  {[        240 238 236]}    
        8 sec             "GHIJ"               {[235 234 233 232 231]}                 "eight"                  {[        235 233 231]}    
        9 sec             "KLMN"               {[255 255 255 255 255]}                 "nine"                   {[255 255 255 255 255]}