Main Content


Read MAVLink message from TLOG file


The mavlinktlog object reads all messages from a telemetry log or TLOG file (.tlog). The object gives you information about the file, including the start and end time, number of messages, available topics, and packet loss percentage. You can specify a MAVLink dialect for parsing the messages or use the common.xml dialect.




tlogReader = mavlinktlog(filePath) reads all messages from the tlog file at the given file path and returns an object summarizing the file. This syntax uses the common.xml dialect for the MAVLink protocol (Version 2.0) for parsing the messages. The information in filePath is used to set the FileName property.

tlogReader = mavlinktlog(filePath,dialect) reads the MAVLink messages based on the dialect specified as a mavlinkdialect object or string scalar specifying the XML file path. dialect sets the Dialect property.


expand all

This property is read-only.

Name of the TLOG file, specified as a string scalar or character vector. The name is the last part of the path given in the filePath input.

Example: 'flightlog.tlog'

Data Types: string | char

This property is read-only.

MAVLink dialect used for parsing the message data, specified as a mavlinkdialect object.

This property is read-only.

Time of the first message recorded in the TLOG file, specified as a datetime object.

Data Types: datetime

This property is read-only.

Time of the last message recorded in the TLOG file, specified as a datetime object.

Data Types: datetime

This property is read-only.

Number of MAVLink messages in the TLOG file, specified as a numeric scalar.

Data Types: double

This property is read-only.

List of different messages, specified as a table that contains:

  • MessageID

  • MessageName

  • SystemID

  • ComponentID

  • NumMessages

Data Types: table

This property is read-only.

Percentage of packets lost, specified as a numeric scalar from 0 through 100.

Data Types: double

Object Functions

readmsgRead specific messages from TLOG file


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   

Version History

Introduced in R2019a