nmeaParser
Parse data from standard and manufacturer-specific NMEA sentences sent from marine electronic devices
Since R2020b
Description
The nmeaParser
System object™ parses data from any NMEA (National Marine Electronics Association) sentences.
The sentences that need parsing of data can be any standard sentences compliant with the
NMEA 0183® specifications (which are sent from a GNSS (Global Navigation Satellite System)
receiver), or other manufacturer-specific sentences approved by the NMEA (which are sent from
other marine electronic devices).
The nmeaParser
System object provides:
Built-in support to parse data sent from GNSS receivers and identified by these nine NMEA message types: RMC, GGA, GSA, VTG, GLL, GST, ZDA, GSV, and HDT
Additional configuration using the
CustomSentence
name-value pair to parse NMEA data from multiple device categories, including manufacturer-specific sentences from different hardware manufacturers
To parse data from NMEA sentences:
Create the
nmeaParser
object and set its properties.Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
The nmeaParser
System object outputs an array of structures corresponding to the values extracted from the
specified NMEA sentences.
Creation
Syntax
Description
returns a
pnmea
= nmeaParsernmeaParser
System object, pnmea
, with default properties, that extracts data
from these standard NMEA messages: RMC, GGA, and GSA. The order of structure arrays in the
extracted output data is also: RMC, GGA, and GSA.
returns a pnmea
= nmeaParser("MessageIDs", 'msgID')nmeaParser
System object, pnmea
, that extracts data from one of the nine
standard NMEA messages with built-in support, specified using the Message IDs. Specify
msgID
as "RMC"
, "GGA"
,
"GSA"
, "GSV"
, "VTG"
,
"GLL"
, "GST"
, "ZDA"
, and
"HDT"
, or a combination of these IDs (for example:
["VTG","GLL","HDT"]
). The order in which you specify the Message IDs
determines the order of the structure arrays in the extracted output data. The default
value is ["RMC","GGA","GSA"]
.
sets properties using the pnmea
= nmeaParser("CustomSentence", {['CustomMessageId1','parserFunctionName1'],['CustomMessageId2','parserFunctionName2']})CustomSentence
name-value pair and returns
a nmeaParser
System object, pnmea
, that extracts data from any custom NMEA message
(either standard NMEA message or manufacturer-specific NMEA message), specified using the
message IDs.
The CustomSentence
name-value pair accepts a nested cell array
where each element is a pair of message ID name (either standard NMEA message ID name or
manufacturer-specific message ID) and the corresponding user-defined parser function,
which is created by including the extractNMEASentence
function in a function
file. The order in which you specify the message IDs determines the order of the structure
arrays in the extracted output data.
returns a pnmea
= nmeaParser("MessageIDs", {'msgID1','msgID2'},"CustomSentence", {['CustomMessageId1','parserFunctionName1'],['CustomMessageId2','parserFunctionName2']})nmeaParser
System object, pnmea
, that extracts data from two of the nine
standard NMEA messages with built-in support and also from custom NMEA messages that you
specified using the CustomSentence
name-value pair.
Input 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: pnmea = nmeaParser("CustomSentence",
{['CustomMessageId1','parserFunctionName1'],['CustomMessageId2','parserFunctionName2']});
CustomSentence
— Specify message ID of any sentence and the name of its parser function
cell array of character vectors
Specify the message ID of any NMEA sentence from which you want to extract data
and the name of the parser function. You can specify multiple message IDs and parser
functions as a cell array of character vectors. The parser function is defined in a
function file, which can optionally include the extractNMEASentence
function.
Note
The function file for the parser function must be present in the current directory or on MATLAB path.
CustomSentence
accepts function name or function handle.
For example, both these formats are valid:
pnmea = nmeaParser('CustomSentence', {['standardnmeaMessageId1','parserFunctionName1']}
parserFunctionHandle=@parserFunctionName1 pnmea = nmeaParser('CustomSentence', {['standardnmeaMessageId1',parserFunctionHandle]}
Note
Using CustomSentence
name-value pair to parse data
instead of the built-in parser function results in override of the default fields
when data is parsed. For example,
nmeaParser('CustomSentence',{["RMC","parserRMC"]})
overrides
the default format of parsed data as RMC is one of the nine sentences with
built-in support for parsing data.
Data Types: char
| string
Properties
Unless otherwise indicated, properties are nontunable, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
release
function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
MessageIDs
— Message IDs of nine standard NMEA sentences with built-in support to extract data
["RMC","GGA","GSA"]
(default) | RMC
| GGA
| GSA
| GSV
| VTG
| GLL
| GST
| ZDA
| HDT
Message IDs of nine NMEA sentences with built-in support, which are compliant with the NMEA 0183 Standard, from which you want to extract data. You can specify multiple message IDs as an array of strings to extract data from NMEA sentences.
Data Types: char
| string
Usage
Syntax
Description
[
parses data from nine standard NMEA sentences with built-in support, and returns an array
of structures, where each structure corresponds to a single Message ID. The sequence that
you specify for the output arguments must be the same sequence that you specified for the
Message IDs when creating the rmcData
,ggaData
,gsaData
,vtgData
,gllData
,gstData
,gsvData
,zdaData
,hdtData
] = pnmea(rawData
)nmeaParser
System object.
[
parses data from two custom NMEA sentences (either standard NMEA sentence or
manufacturer-specific NMEA sentence), and returns an array of structures, where each
structure corresponds to a single Message ID. The sequence that you specify for the output
arguments must be the same sequence that you specified in the
customNmeaData1
,customNmeaData2
] = pnmea(rawData
)CustomSentence
name-value pair when creating the
nmeaParser
System object.
Input Arguments
rawData
— NMEA data as obtained from a marine electronic device
string array
NMEA data, which is compliant with NMEA standard, as obtained from a marine electronic device.
Data Types: string
| char
Output Arguments
rmcData
— Data extracted from RMC sentence
structure
Data extracted from an RMC sentence. The output structure contains the information parsed from an RMC sentence along with the parsing status. If multiple RMC sentences are found in the input data, then an array of structures is returned. For more details, see RMC Sentences.
ggaData
— Data extracted from GGA sentence
structure
Data extracted from a GGA sentence. The output structure contains the information parsed from a GGA sentence along with the parsing status. If multiple GGA sentences are found in the input data, then an array of structures is returned. For more details, see GGA Sentences.
gsaData
— Data extracted from GSA sentence
structure
Data extracted from a GSA sentence. The output structure contains the information parsed from a GSA sentence along with the parsing status. If multiple GSA sentences are found in the input data, then an array of structures is returned. For more details, see GSA Sentences.
vtgData
— Data extracted from VTG sentence
structure
Data extracted from a VTG sentence. The output structure contains the information parsed from a VTG sentence along with the parsing status. If multiple VTG sentences are found in the input data, then an array of structures is returned. For more details, see VTG Sentences.
gllData
— Data extracted from GLL sentence
structure
Data extracted from a GLL sentence. The output structure contains the information parsed from a GLL sentence along with the parsing status. If multiple GLL sentences are found in the input data, then an array of structures is returned. For more details, see GLL Sentences.
gstData
— Data extracted from GST sentence
structure
Data extracted from a GST sentence. The output structure contains the information parsed from a GST sentence along with the parsing status. If multiple GST sentences are found in the input data, then an array of structures is returned. For more details, see GST Sentences.
gsvData
— Data extracted from GSV sentence
structure
Data extracted from a GSV sentence. The output structure contains the information parsed from a GSV sentence along with the parsing status. The complete satellite information is available in multiple gsvData structures. Each gsvData structure can have a maximum of four satellite information. For more details, see GSV Sentences.
zdaData
— Data extracted from ZDA sentence
structure
Data extracted from a ZDA sentence. The output structure contains the information parsed from a ZDA sentence along with the parsing status. If multiple ZDA sentences are found in the input data, then an array of structures is returned. For more details, see ZDA Sentences.
hdtData
— Data extracted from HDT sentence
structure
Data extracted from an HDT sentence. The output structure contains the information parsed from an HDT sentence along with the parsing status. If multiple HDT sentences are found in the input data, then an array of structures is returned. For more details, see HDT Sentences.
customNmeaData1
— Data extracted from any standard or manufacturer-specific NMEA sentence
structure
Data extracted from any standard or manufacturer-specific NMEA sentence. The output structure contains the information parsed from the custom sentence along with the parsing status. If multiple sentences of the same NMEA message type are found in the input data, then an array of structures is returned.
Object Functions
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)
Examples
Extract Data from NMEA Sentences Using MessageID Property
Extract data from any of the nine standard NMEA sentences as part of the built-in support using the MessageID property. The NMEA data is obtained from a GNSS receiver.
Extract Data from RMC Sentence
Create an nmeaParser System Object by specifying the Message ID as "RMC".
pnmea = nmeaParser("MessageID","RMC");
Provide the RMC sentence obtained from the GNSS receiver as the input and extract data.
unparsedRMCLine='$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31';
rmcData = pnmea(unparsedRMCLine)
rmcData = struct with fields:
TalkerID: "GN"
MessageID: "RMC"
FixStatus: 'A'
Latitude: 51.1167
Longitude: -114.0388
GroundSpeed: 0.0185
TrueCourseAngle: 348.3000
UTCDateTime: 21-Mar-2007 14:39:09.000
MagneticVariation: 0
ModeIndicator: 'A'
NavigationStatus: "NA"
Status: 0
Extract Data from Multiple NMEA Message Types
Provide GGA, GSA, and RMC sentences as the input.
unparsedGGALine = ['$GPGGA,111357.771,5231.364,N,01324.240,E,1,12,1.0,0.0,M,0.0,M,,*69']; unparsedGSALine = ['$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30']; unparsedRMCLine = ['$GPRMC,111357.771,A,5231.364,N,01324.240,E,10903,221.5,020620,000.0,W*44'];
Create a string array to include the three sentences
rawNMEAData = [unparsedGGALine ,newline, unparsedGSALine ,newline, unparsedRMCLine]
rawNMEAData = '$GPGGA,111357.771,5231.364,N,01324.240,E,1,12,1.0,0.0,M,0.0,M,,*69 $GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30 $GPRMC,111357.771,A,5231.364,N,01324.240,E,10903,221.5,020620,000.0,W*44'
However, consider that you need to extract data only from GGA and GSA sentences. So create the nmeaParser System Object 'pnmea', and specify the 'GGA' and 'GSA' Message IDs as a string array.
pnmea=nmeaParser("MessageIDs",["GGA","GSA"]);
Specify the output arguments for all the three sentences to extract the data as structures.
[ggaData,gsaData] = pnmea(rawNMEAData)
ggaData = struct with fields:
TalkerID: "GP"
MessageID: "GGA"
UTCTime: 11:13:57.771
Latitude: 52.5227
Longitude: 13.4040
QualityIndicator: 1
NumSatellitesInUse: 12
HDOP: 1
Altitude: 0
GeoidSeparation: 0
AgeOfDifferentialData: NaN
DifferentialReferenceStationID: NaN
Status: 0
gsaData = struct with fields:
TalkerID: "GP"
MessageID: "GSA"
Mode: "A"
FixType: 3
SatellitesIDNumber: [1 2 3 4 5 6 7 8 9 10 11 12]
PDOP: 1
VDOP: 1
HDOP: 1
SystemID: NaN
Status: 0
The above output shows that only GGA and GSA sentences are extracted based on the Message IDs specified as input.
Provide another GGA sentence as an additional input, and extract data. In this case, you need not modify the System object as the Message ID has not changed.
unparsedGGALine1='$GNGGA,001043.00,4404.14036,N,12118.85961,W,1,12,0.98,1113.0,M,-21.3,M,,*47'
unparsedGGALine1 = '$GNGGA,001043.00,4404.14036,N,12118.85961,W,1,12,0.98,1113.0,M,-21.3,M,,*47'
rawNMEAData = [unparsedGGALine ,newline, unparsedGSALine ,newline, unparsedGGALine1]
rawNMEAData = '$GPGGA,111357.771,5231.364,N,01324.240,E,1,12,1.0,0.0,M,0.0,M,,*69 $GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30 $GNGGA,001043.00,4404.14036,N,12118.85961,W,1,12,0.98,1113.0,M,-21.3,M,,*47'
[ggaData,gsaData] = pnmea(rawNMEAData)
ggaData=2×1 struct array with fields:
TalkerID
MessageID
UTCTime
Latitude
Longitude
QualityIndicator
NumSatellitesInUse
HDOP
Altitude
GeoidSeparation
AgeOfDifferentialData
DifferentialReferenceStationID
Status
gsaData = struct with fields:
TalkerID: "GP"
MessageID: "GSA"
Mode: "A"
FixType: 3
SatellitesIDNumber: [1 2 3 4 5 6 7 8 9 10 11 12]
PDOP: 1
VDOP: 1
HDOP: 1
SystemID: NaN
Status: 0
A status of 0 indicates that the data was parsed successfully.
Extract Data from GSV Sentence
Create an nmeaParser System Object by specifying the Message ID as "GSV".
pnmea = nmeaParser("MessageID","GSV");
Provide the GSV sentence obtained from the GNSS receiver as the input and extract data.
unparsedGSVLine='$GPGSV,3,3,10,32,69,205,41,46,47,215,39*79';
gsvData = pnmea(unparsedGSVLine)
gsvData = struct with fields:
TalkerID: "GP"
MessageID: "GSV"
NumSentences: 3
SentenceNumber: 3
SatellitesInView: 10
SatelliteID: [32 46]
Elevation: [69 47]
Azimuth: [205 215]
SNR: [41 39]
SignalID: NaN
Status: 0
Extract Data from Multiple GSV Sentences
Provide multiple GSV sentences as the input.
unparsedGSVLine1 = '$GPGSV,3,1,10,01,,,31,03,28,325,40,10,,,33,12,20,047,30*70'; unparsedGSVLine2 = '$GPGSV,3,2,10,14,88,028,42,22,39,299,48,25,,,25,31,79,289,46*49'; unparsedGSVLine3 = '$GPGSV,3,3,10,32,69,205,41,46,47,215,39*79';
Create a string array to include the three sentences.
CRLF = [char(13),newline]; unparsedGSVLines = [unparsedGSVLine1,CRLF, unparsedGSVLine2, CRLF, unparsedGSVLine3];
Create the nmeaParser System Object 'pnmea', specify the 'GSV' Message ID, and extract data.
pnmea = nmeaParser("MessageIDs","GSV"); gsvData = pnmea(unparsedGSVLines)
gsvData=3×1 struct array with fields:
TalkerID
MessageID
NumSentences
SentenceNumber
SatellitesInView
SatelliteID
Elevation
Azimuth
SNR
SignalID
Status
Read Data from NMEA Log
Read data from a sample NMEA log, so that the data can be parsed using the nmeaParser System Object.
The sample log file is nmeaLog.nmea
, which is included in this example.
f = fopen('nmeaLog.nmea'); unParsedNMEAdata = fread(f); pnmea = nmeaParser("MessageIDs",["RMC","GGA"]); [rmcStruct, ggaStruct] = pnmea(unParsedNMEAdata)
rmcStruct=9×1 struct array with fields:
TalkerID
MessageID
FixStatus
Latitude
Longitude
GroundSpeed
TrueCourseAngle
UTCDateTime
MagneticVariation
ModeIndicator
NavigationStatus
Status
ggaStruct=9×1 struct array with fields:
TalkerID
MessageID
UTCTime
Latitude
Longitude
QualityIndicator
NumSatellitesInUse
HDOP
Altitude
GeoidSeparation
AgeOfDifferentialData
DifferentialReferenceStationID
Status
Extract Data Using CustomSentence Name-Value Pair
You can extract data from any NMEA sentence using the CustomSentence
name-value pair. The NMEA data to be parsed is obtained from marine electronic devices.
Identify the Structure of NMEA Sentence and Create the Parser Function
You need to identify the structure of the NMEA sentence, as defined in the specification, and use that information to define the structure of output data to be used in the nmeaParser System object.
For example, let us consider an example sentence with Message ID, SSS
.
After identifying the structure, you create a function file that defines the parser function, fsssParser. In the function file, you define the output data as a structure array with its fields matching the sequence as it appears in the specification.
The Navigation Toolbox™ provides an optional pre-configured function, extractNMEASentence
, that checks if the sentence is valid and convert the fields in the sentence into string array. You can call extractNMEASentence
inside the function file. You can also use any other function instead (which outputs a string array from unparsed data), and then call it inside the function file.
The below image shows the function file with the code, with the assumption that the fields available in SSS
sentence are TalkerID, MessageID, UTC, and LatitudeError. Refer the additional comments for details.
In the above sample file, you define the mapping between the fields in the structure array and the elements of string array. For certain fields (for example, UTC time), you may need to define a character array to map the fields.
After you include the MATLAB code as mentioned above, save the function file (fsssParser.m) in the MATLAB path, so that you can call it to obtain parsed data using the CustomSentence
name-value pair of nmeaParser System object.
To download another sample function file parserRMB.m that is used this example, click Open Live Script. This is a function file specific to the fields of an RMB sentence (mentioned in NMEA Standard, Version 4.1).
Extract Data from RMB Sentence
Create an nmeaParser System Object by using the CustomSentence name-value pair and specifying the message ID as "RMB" and the function as "parserRMB" (downloaded in the previous step).
pnmea = nmeaParser("CustomSentence",{["RMB","parserRMB"]});
Provide the RMB sentence obtained from the GNSS receiver as the input and extract data.
unparsedRMBLine='$GPRMB,A,4.08,L,EGLL,EGLM,5130.02,N,00046.34,W,004.6,213.9,122.9,A*3D';
rmbData = pnmea(unparsedRMBLine)
rmbData = struct with fields:
TalkerID: "GP"
MessageID: "RMB"
DataStatus: 'A'
CrossTrackError: 4.0800
DirectionToSteer: NaN
OriginWaypointID: NaN
DestinationWaypointID: NaN
DestinationWaypointLatitude: '5130.02 N'
DestinationWaypointLongitude: '00046.34 W'
RangeToDestination: 4.6000
BearingToDestination: 213.9000
DestinationClosingVelocity: 122.9000
ArrivalStatus: 'A'
ModeIndicator: "NA"
Status: 0
Extract Data from Multiple RMB Sentences
Provide multiple RMB sentences as the input.
unparsedRMBLine1 = ['$GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*20']; unparsedRMBLine2 = ['$GPRMB,A,4.08,L,EGLL,EGLM,5130.02,N,00046.34,W,004.6,213.9,122.9,A*3D'];
Create a character array to include the two sentences
rawNMEAData = [unparsedRMBLine1 ,newline, unparsedRMBLine2]
rawNMEAData = '$GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*20 $GPRMB,A,4.08,L,EGLL,EGLM,5130.02,N,00046.34,W,004.6,213.9,122.9,A*3D'
Specify the output argument for the RMB sentence to extract the data.
[rmbData] = pnmea(rawNMEAData)
rmbData=2×1 struct array with fields:
TalkerID
MessageID
DataStatus
CrossTrackError
DirectionToSteer
OriginWaypointID
DestinationWaypointID
DestinationWaypointLatitude
DestinationWaypointLongitude
RangeToDestination
BearingToDestination
DestinationClosingVelocity
ArrivalStatus
ModeIndicator
Status
Extract Data from a Sentence with Built-in Support (RMC) and RMB Sentence
Create an nmeaParser System Object by using the MessageID property (to parse a sentence with built-in support - RMC) and also using the CustomSentence name-value pair (specifying the message ID as "RMB" and the function as "parserRMB" (created in a previous step)).
pnmea = nmeaParser("MessageID","RMC","CustomSentence",{["RMB","parserRMB"]});
Provide RMC and RMB sentences as the input.
unparsedRMCLine1 = ['$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31']; unparsedRMBLine2 = ['$GPRMB,A,4.08,L,EGLL,EGLM,5130.02,N,00046.34,W,004.6,213.9,122.9,A*3D'];
Create a string array to include the two sentences
rawNMEAData = [unparsedRMCLine1 ,newline, unparsedRMBLine2]
rawNMEAData = '$GNRMC,143909.00,A,5107.0020216,N,11402.3294835,W,0.036,348.3,210307,0.0,E,A*31 $GPRMB,A,4.08,L,EGLL,EGLM,5130.02,N,00046.34,W,004.6,213.9,122.9,A*3D'
Specify the output argument for the RMB sentence to extract the data.
[rmcdata,rmbData] = pnmea(rawNMEAData)
rmcdata = struct with fields:
TalkerID: "GN"
MessageID: "RMC"
FixStatus: 'A'
Latitude: 51.1167
Longitude: -114.0388
GroundSpeed: 0.0185
TrueCourseAngle: 348.3000
UTCDateTime: 21-Mar-2007 14:39:09.000
MagneticVariation: 0
ModeIndicator: 'A'
NavigationStatus: "NA"
Status: 0
rmbData = struct with fields:
TalkerID: "GP"
MessageID: "RMB"
DataStatus: 'A'
CrossTrackError: 4.0800
DirectionToSteer: NaN
OriginWaypointID: NaN
DestinationWaypointID: NaN
DestinationWaypointLatitude: '5130.02 N'
DestinationWaypointLongitude: '00046.34 W'
RangeToDestination: 4.6000
BearingToDestination: 213.9000
DestinationClosingVelocity: 122.9000
ArrivalStatus: 'A'
ModeIndicator: "NA"
Status: 0
Extract Data from a Manufacturer-specific Sentence Using CustomSentence Name-Value Pair
Identify Structure of Manufacturer-specific Sentence and Create Function File with Parser Function
The structure of NMEA sentence to be parsed is available in the specification of the device from the manufacturer. You need to identify the structure and use the information to define the structure of output data to be used in the nmeaParser System object.
For example, the structure of the NMEA sentence from a hardware manufacturer may look like this:
$PMMCZ,hhmmss.ss,Latitude,N,Longitude,E,NavSatellite,DR*hh<CR><LF>
Here, P denotes that the sentence is manufacturer-specific, MMC is the manufacturer mnemonic code, and Z is the sentence type. Each field thereafter indicates a specific data (position, velocity, time, and so on). Some manufacturers use two characters for the sentence type, followed by the data fields.
After identifying the structure, create the parser function,
parserMMCZ
, using the optionalextractNMEASentence
function, as shown below (you can also use other functions to extract the unparsed data to strings, instead ofextractNMEASentence
).function OutputData = parserMMCZ(unparsedData, MessageID) OutputData = struct("MessageID",MessageID,... "UTC","NA",... "Latitude",NaN,... "Longitude",NaN,... "NavigationSatellites",NaN,... "Status",uint8(1)); [isValid, splitString] = extractNMEASentence(unparsedData, MessageID); if(isValid) OutputData.MessageID = splitString(1); temp = char(splitString(2)); utcOutput = [temp(1:2), ':', temp(3:4), ':', temp(5:6)]; OutputData.UTC = utcOutput; OutputData.Latitude = str2double(splitString{3}); OutputData.Longitude = str2double(splitString{5}); OutputData.NavigationSatellites = str2double(splitString{7}); OutputData.Status = uint8(0); end end
Save
parserMMCZ.m
in the MATLAB path.Extract Data from Manufacturer-specific Sentence
Create an
nmeaParser
System Object by using theCustomSentence
name-value pair and specifying the message ID as "MMCZ" and the function as "parserMMCZ" (created in the previous step).pnmea = nmeaParser("CustomSentence",{["MMCZ","parserMMCZ"]});
Provide an MMC sentence obtained from the device as the input and extract data:
unparsedMMCLine='$PMMCZ,225444,4917.24,N,00046.34,E,3,DR*7C'; mmcData = pnmea(unparsedMMCLine)
mmcData = struct with fields: MessageID: "MMCZ" UTC: '22:54:44' Latitude: 4.9172e+03 Longitude: 46.3400 NavigationSatellites: 3 Status: 0
More About
Status Field
The status field displayed along with the extracted values in each output structure can be used to determine the parsing status:
Status: 0
— Sentence is valid (checksum validation is successful and the extracted data is as per the requested Message ID)Status: 1
— Checksum of the sentence to be parsed is invalidStatus: 2
— The requested sentence is not found in the input data
Note
If a value is not available in the input sentence, the corresponding output value is displayed as “NA” for string values and "NaN" for numeric values.
RMC Sentences
Name of field displayed in the output structure after parsing is complete | Description |
---|---|
TalkerID | Identify the type of device that transmits data. For example, for a GPS
receiver, the TalkerID is Data type:
|
MessageID | Type of NMEA message – Data type:
|
FixStatus | Possible values:
Data type:
|
Latitude | Latitude in degrees. North is considered positive. Data
type: |
Longitude | Longitude in degrees. East is considered positive. Data
type: |
GroundSpeed | Speed over ground in meters per second (m/s) Data type:
|
TrueCourseAngle | Course over ground in degrees. Data type:
|
UTCDateTime | UTC date and time Data type:
|
MagneticVariation | Magnetic variation value. Direction W is considered as negative Data type: |
ModeIndicator | Possible values:
Data type:
|
NavigationStatus | Possible values:
Data type:
|
GGA Sentences
Name of field displayed in the output structure after parsing is complete | Description |
---|---|
TalkerID | Identify the type of device that transmits data. For example, for a GPS
receiver, the TalkerID is Data type:
|
MessageID | Type of NMEA message – Data type:
|
UTCTime | UTC Time ( Data type:
|
Latitude | Latitude in degrees. North is considered positive. Data
type: |
Longitude | Longitude in degrees. East is considered positive. Data
type: |
QualityIndicator | Possible values:
Data type: |
NumSatellitesInUse | Number of satellites used. This could be different from number of satellites in view. Data type:
|
HDOP | Horizontal dilution of precision Data type:
|
Altitude | Altitude above mean sea level in meters Data type:
|
GeoidSeparation | Difference between ellipsoid and mean sea level in meters Data type: |
AgeOfDifferentialData | Age of differential corrections Data type:
|
DifferentialReferenceStationID | ID of station providing differential corrections Data type:
|
GSA Sentences
Name of field displayed in the output structure after parsing is complete | Description |
---|---|
TalkerID | Identify the type of device that transmits data. For example, for a GPS
receiver, the TalkerID is Data type:
|
MessageID | Type of NMEA message – Data type:
|
Mode | Possible values:
Data type:
|
FixType | Possible values:
Data type: |
SatellitesIDNumber | Satellite numbers (array of 12 bytes). Empty fields will be displayed
as Data type:
|
PDOP | Position dilution of precision Data type:
|
VDOP | Vertical dilution of precision Data type:
|
HDOP | Horizontal Dilution of Precision Data type:
|
SystemID | NMEA defined GNSS System ID Data type:
|
GSV Sentences
Name of field displayed in the output structure after parsing is complete | Description |
---|---|
TalkerID | Identify the type of device that transmits data. For example, for a GPS
receiver, the TalkerID is Data type:
|
MessageID | Type of NMEA message – Data type:
|
NumSentences | Total number of sentences. The complete satellite information is
available in multiple GSV sentences. This field indicates the total number of
Data type: |
SentenceNumber | Sentence number of the currently parsed GSV line Data type:
|
SatellitesInView | Total number of satellites in view Data type:
|
SatelliteID | Satellite ID numbers specified as a row vector of size 1-by-N, where N is the number of satellite information available in one sentence. The maximum allowed valued of N is 4. Data type:
|
Elevation | Elevation in degrees, specified as a row vector of size 1-by-N, where N is the number of satellite information available in one sentence. The maximum allowed valued of N is 4. The maximum value of Elevation is 90 degrees. Data type: |
Azimuth | Azimuth in degrees, specified as a row vector of size 1-by-N, where N is the number of satellite information available in one sentence. The maximum allowed valued of N is 4. The range of Azimuth value is [0-359] degrees. Data type: |
SNR | Signal-to-noise ratio in dB-Hz, specified as a row vector of size 1-by-N, where N is the number of satellite information available in one sentence. The maximum allowed valued of N is 4. The range of SNR value is [0,99] dB. Data type:
|
SignalID | Signal ID corresponding to the SatelliteID. This value is
displayed only if the sentences conform to NMEA 0183 Standard, Version 4.1.
Otherwise, the value displayed is Data type:
|
The possible values of SignalID and the corresponding Signal Channel are listed in this table.
System | TalkerID displayed in the parsed data | SatelliteID | SignalID | Signal Channel |
---|---|---|---|---|
GPS | GP |
| 0 | All signals |
1 | L1 C/A | |||
2 | L1 P (Y) | |||
3 | L1 M | |||
4 | L2 P (Y) | |||
5 | L2C-M | |||
6 | L2C-L | |||
7 | L5-I | |||
8 | L5-Q | |||
GLONASS | GL |
| 0 | All signals |
1 | G1 C/A | |||
2 | G1 P | |||
3 | G2 C/A | |||
4 | GLONASS (M) G2 P | |||
GALILEO | GA |
| 0 | All signals |
1 | E5a | |||
2 | E5b | |||
3 | E5a and E5b | |||
4 | E6-A | |||
5 | E6-BC | |||
6 | L1-A | |||
7 | L1-BC |
ZDA Sentences
Name of field displayed in the output structure after parsing is complete | Description |
---|---|
TalkerID | Identify the type of device that transmits data. For example, for a GPS
receiver, the TalkerID is Data type:
|
MessageID | Type of NMEA message – Data type:
|
UTCTime | UTC Time Data type:
|
UTCDay | UTC Day Data type:
|
UTCMonth | UTC Month Data type:
|
UTCYear | UTC Year Data type:
|
LocalZoneHours | Local zone hours ranging from Data type:
|
LocalZoneMinutes | Local zone minutes ranging from Data type:
|
GLL Sentences
Name of field displayed in the output structure after parsing is complete | Description |
---|---|
TalkerID | Identify the type of device that transmits data. For example, for a GPS
receiver, the TalkerID is Data type:
|
MessageID | Type of NMEA message – Data type:
|
Latitude | Latitude in degrees. North is considered positive. Data
type: |
Longitude | Longitude in degrees. East is considered positive. Data
type: |
UTCTime | UTC Time Data type:
|
DataValidity | Data validity status:
Data type:
|
PositioningMode | Possible values:
Data type:
|
VTG Sentences
Name of field displayed in the output structure after parsing is complete | Description |
---|---|
TalkerID | Identify the type of device that transmits data. For example, for a GPS
receiver, the TalkerID is Data type:
|
MessageID | Type of NMEA message – Data type:
|
TrueCourseAngle | Course over ground (true) in degrees Data type:
|
MagneticCourseAngle | Course over ground (magnetic) in degrees Data type:
|
GroundSpeed | Speed over ground in meters per second (m/s) Data type:
|
ModeIndicator | Possible values:
Data type:
|
GST Sentences
Name of field displayed in the output structure after parsing is complete | Description |
---|---|
TalkerID | Identify the type of device that transmits data. For example, for a GPS
receiver, the TalkerID is Data type:
|
MessageID | Type of NMEA message – Data type:
|
UTCTime | UTC Time Data type:
|
RMSStdDeviationOfRanges | RMS value of the standard deviation of the ranges in meters. Data type: |
StdDeviationSemiMajorAxis | Standard deviation of semi-major axis in meters Data type:
|
StdDeviationSemiMinorAxis | Standard deviation of semi-minor axis in meters Data type:
|
OrientationSemiMajorAxis | Orientation of semi-major axis, in degrees Data type:
|
StdDeviationLatitudeError | Standard deviation of latitude error, in meters Data type:
|
StdDeviationLongitudeError | Standard deviation of longitude error in meters Data type:
|
StdDeviationAltitudeError | Standard deviation of altitude error in meters Data type:
|
HDT Sentences
Name of field displayed in the output structure after parsing is complete | Description |
---|---|
TalkerID | Identify the type of device that transmits data. For example, for a GPS
receiver, the TalkerID is Data type:
|
MessageID | Type of NMEA message – Data type:
|
TrueHeadingAngle | Heading in degrees with respect to true north Data type:
|
Version History
Introduced in R2020b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)