Read data from GPS receiver
[
returns matrices of measurements from the GPS. This is a non blocking read which
returns N data points in matrix format where N is specified by
lla
,groundSpeed
,course
, dops
,gpsReceiverTime
,timestamp
, overrun
] = read(gpsObj
)SamplesPerRead
and matrix
is specified
using OutputFormat
property of the gpsdev
object.
Create GPS object with properties available.
g = gpsdev('COM4','OutputFormat','timetable','SamplesPerRead',2)
Read samples of GPS.
[tt,overruns] = read(g)
tt = 2×5 timetable Time LLA GroundSpeed Course DOPs GPSReceiverTime ________________________ __________________________ ___________ ______ ____________________ ________________________ 31-Jan-2020 11:32:49.459 12.944 77.692 806.8 0.0463 258.87 1.31 0.99 0.85 31-Jan-2020 06:02:49.000 31-Jan-2020 11:32:50.416 12.944 77.692 806.9 0.12861 262.7 1.31 0.99 0.85 31-Jan-2020 06:02:50.000 overrun = 0
Display the time at which GPS data is read, in duration
format.
g.TimeFormat = “duration”; [tt,overruns] = read(g)
tt = 2×5 timetable Time LLA GroundSpeed Course DOPs GPSReceiverTime __________ __________________________ ___________ ______ ____________________ ________________________ 9.4257 sec 12.944 77.692 808.4 0.030867 4.93 1.51 0.78 1.29 31-Jan-2020 06:15:24.000 10.404 sec 12.944 77.692 808.4 0.051444 41.26 1.1 0.76 0.79 31-Jan-2020 06:15:25.000 overrun = 0
Create GPS object with properties available.
g = gpsdev('COM4', "OutputFormat","matrix",'SamplesPerRead',2);
Read samples of GPS data.
[lla,speed,course,dops,gpsReceiverTime,timestamp,overruns] = read(g)
lla = 12.9437 77.6916 807.4000 12.9437 77.6916 807.4000 speed = 0.0154 0.0463 course = 346.0100 270.2100 dops = 1.2400 0.9200 0.8300 1.7700 0.9900 1.4700 gpsReceiverTime = 2×1 datetime array 31-Jan-2020 06:07:01.000 31-Jan-2020 06:07:02.000 timestamp = 2×1 datetime array 31-Jan-2020 11:37:01.734 31-Jan-2020 11:37:02.436 overruns = 0