This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


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

This example shows how to load a MAVLink TLOG file and select a specific message type.

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

tlogReader = mavlinktlog('flight.tlog');

Read the 'REQUEST_DATA_STREAM' messages from the file.

msgData = readmsg(result,'MessageName','REQUEST_DATA_STREAM');

Introduced in R2019a