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

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');

Input Arguments

collapse all

MAVLink TLOG reader, specified as a mavlinktlog object.

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

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.

Introduced in R2019a