Main Content


Read specific messages from TLOG file


msgTable = readmsg(tlogReader) reads all message data from the specified mavlinkdialect object and returns a table, msgTable, that contains all the messages separated by message type, system ID, and component ID.


msgTable = readmsg(tlogReader,Name,Value) reads specific messages based on the specified name-value pairs for filtering specific properties of the messages. You can filter by message name, system ID, component ID, and time.


collapse all

Load the TLOG file. Specify the relative path of the file name.

tlogReader = mavlinktlog("mavlink_flightlog.tlog")
tlogReader = 
  mavlinktlog with properties:

           FileName: "mavlink_flightlog"
            Dialect: [1x1 mavlinkdialect]
          StartTime: '2018-05-18 17:53:28.893 (0.000 Seconds)'
            EndTime: '2018-05-18 18:04:52.524 (683.631 Seconds)'
        NumMessages: 20370
    AvailableTopics: [5x5 table]
     NumPacketsLost: 251

Read the "HEARTBEAT" messages from the file.

msgData = readmsg(tlogReader,"MessageName","HEARTBEAT")
msgData=1×6 table
    MessageID    MessageName    SystemID    ComponentID         Messages         Version
    _________    ___________    ________    ___________    __________________    _______

        0        "HEARTBEAT"       5             1         {3897x6 timetable}       2   

Input Arguments

collapse all

MAVLink TLOG reader, specified as a mavlinktlog object.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'MessageID',22

Name of message in TLOG, specified as string scalar or character vector.

Data Types: char | string

MAVLink system ID, specified as a positive integer from 1 through 255. MAVLink protocol only supports up to 255 systems. Usually, each UAV has its own system ID, but multiple UAVs could be considered one system.

MAVLink system ID, specified as a positive integer from 1 through 255.

Time interval between which to select messages, specified as a two-element vector in seconds.

Output Arguments

collapse all

Table of messages with columns:

  • MessageID

  • MessageName

  • ComponentID

  • SystemID

  • Messages

Each row of Messages is a timetable containing the message Payload and the associated timestamp.

Version History

Introduced in R2019a