メインコンテンツ

このページは機械翻訳を使用して翻訳されました。最新版の英語を参照するには、ここをクリックします。

timetable データをMDFファイルに書き込む際にメタデータをカスタマイズする

この例では、timetable データを MDF ファイルに書き込むときに、ファイル、チャネル グループ、およびチャネル メタデータをカスタマイズする方法を示します。

この例で使用される MAT ファイル MDFTimetables.mat には、2 つの timetable が含まれています。

  • timetable TT1 には、uint8、uint16、uint32、uint64、int8、int16、int32、int64、single、double などの数値データ型の変数があります。

  • timetable TT2 には、固定長データと可変長データの両方を含む文字列およびバイト配列データ型の変数があります。

この例では、TT1TT2 のデータが、新しい MDF ファイルのチャネル グループ 1 と 2 にそれぞれ書き込まれます。MDF ファイルに書き込むときにメタデータをカスタマイズする必要がある場合は、この高度なワークフローを使用する必要があります。

この例をさらに進める前に、まず MDF ファイル構造と、例 timetable データを MDF ファイルに書き込む方法 で示されている基本的なワークフローについて学習する必要があります。

ワークスペースに timetable を読み込む

timetable 変数 TT1TT2MDFTimetables.mat からワークスペースに読み込みます。

load("MDFTimetables.mat")

カスタマイズされたファイルメタデータを使用して新しい MDF ファイルを作成する

入力引数なしの関数 mdfInfo を使用して、デフォルトのファイル メタデータを含む MDFInfo オブジェクトを作成します。表示されるプロパティは、設定可能なファイル メタデータのサブセットを表すことに注意してください。

info = mdfInfo
info = 
  MDFInfo with properties:

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

   Creator Details
     CreatorUserName: ""
      CreatorComment: ""

ファイルに関する詳細情報を提供するには、Author および Comment プロパティを設定します。

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

Version をデフォルトから "4.10" に変更します。

info.Version = "4.10";

ファイル作成に関する詳細情報を提供するには、CreatorComment プロパティを設定します。

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

更新された MDFInfo オブジェクトを表示します。

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"

更新されたファイル情報オブジェクトを指定するには、関数 mdfCreate とオプション FileInfo を使用します。これにより、ディスク上に新しいスケルトン MDF ファイル TimetableAdvanced.mf4 が作成されます。更新されたメタデータ値はカスタマイズされたフィールドに適用され、他のフィールドにはデフォルト値が適用されます。

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

ファイルのメタデータを調べる

作成された MDF ファイルに正しいファイル メタデータが含まれていることを確認するには、MDF ファイル名を指定して mdfInfo を再度呼び出し、返されたオブジェクトを調べます。

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

   File Details
                  Name: "TimetableAdvanced.mf4"
                  Path: "/tmp/Bdoc25a_2864802_1971459/tpcbc94420/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: 2025-02-01 19:15:48.000000000

   Creator Details
     ProgramIdentifier: "MATLAB"
     CreatorVendorName: "The MathWorks, Inc."
       CreatorToolName: "MATLAB"
    CreatorToolVersion: "25.1.0.2847070 (R2025a) Prerelease Update 3"
       CreatorUserName: ""
        CreatorComment: "Created using MATLAB for demonstration"

   File Contents
            Attachment: [0×7 table]
     ChannelGroupCount: 0
                 Event: [0×8 eventtable]

チャネルグループメタデータとチャネルメタデータをカスタマイズする

関数 mdfAddChannelGroupMetadata は、デフォルトまたは推測されたチャネル グループ メタデータとチャネル メタデータをカスタム プロパティとして入力 timetable に追加し、結果の timetable を返します。この関数を使用して、さらなるカスタマイズの基礎となるデフォルトのメタデータを設定します。

チャネル グループ メタデータとチャネル メタデータを TT1 に追加し、結果の timetable を新しい変数 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   
      ⋮

新しい timetable のカスタム プロパティを調べます。プロパティ ChannelTypeChannelDataType、および ChannelNumBits は、対応する timetable 変数に格納されたデータから mdfAddChannelGroupMetadata によって推論されたことに注意してください。残りのプロパティはデフォルト値に設定されました。

表示される最初の 3 つのプロパティは、timetable 全体に適用されるメタデータであり、残りのプロパティは各変数に適用されるメタデータです。timetable はチャネル グループを表し、timetable 内の変数はチャネルを表します。最初の 3 つのプロパティはチャネル グループのメタデータを表し、残りのプロパティはチャネルのメタデータを表します。

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    …    ] (1×10 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]

timetable のプロパティ ChannelGroupComment を設定し、このチャネル グループに関する詳細情報を提供します。

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

timetable 内の各変数にプロパティ ChannelComment を設定し、各チャネルに関する詳細情報を提供します。ChannelComment プロパティにインデックスを付けるには、変数インデックスまたは変数名のいずれかを使用できます。

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";

チャネル グループとチャネルの更新されたメタデータを表示します。

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"    …    ] (1×10 string)
                           ChannelUnit: [""    ""    ""    ""    ""    ""    ""    ""    ""    ""]
                           ChannelType: [FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength    FixedLength]
                       ChannelDataType: [IntegerUnsignedLittleEndian    IntegerUnsignedLittleEndian    IntegerUnsignedLittleEndian    IntegerUnsignedLittleEndian    IntegerSignedLittleEndian    …    ] (1×10 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]

同様に、チャネル グループ メタデータとチャネル メタデータを TT2 に追加し、結果の timetable を新しい変数 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]}    

新しい 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]

timetable プロパティ ChannelGroupComment を設定し、このチャネル グループに関する詳細情報を提供します。

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

timetable 内の各変数にプロパティ ChannelComment を設定し、各チャネルに関する詳細情報を提供します。

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";

チャネル グループとチャネルの更新されたメタデータを表示します。

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"    …    ] (1×4 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]

カスタマイズされたチャネル グループ メタデータとチャネル メタデータを使用して MDF ファイルにデータを書き込む

ここで、TT1WithMetadata は、チャネル グループ 1 に書き込まれるデータと、このチャネル グループとそのチャネル用に構成されるメタデータを伝送します。TT2WithMetadataについても同様です。

mdfWrite を使用して、カスタマイズされたメタデータを含む 2 つの timetable を、前の手順で作成したスケルトン ファイル TimetableAdvanced.mf4 に書き込みます。

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

チャネルグループのメタデータを調べる

mdfChannelGroupInfo を使用して TimetableAdvanced.mf4 に書き込まれた 2 つのチャネル グループのメタデータを調べます。

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     

チャネルのメタデータを調べる

mdfChannelInfo を使用して、チャネル グループ 1 内のチャネルのメタデータを調べます。追加のメタデータも表示するには、AdditionalMetadata オプションを true として指定します。

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     

同様に、チャネル グループ 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     

データを検証する

データがファイルに正常に書き込まれたことを確認するには、mdfRead を使用して両方のチャネル グループからデータを読み取り、結果を調べます。

data = mdfRead("TimetableAdvanced.mf4")
data=2×1 cell array
    {100×10 timetable}
    { 10×4  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]}