File Exchange

image thumbnail

Serial Object GPS Example Code

version (18.5 KB) by Peter Webb
Read tracklog data from Garmin eTrex GPS devices.


Updated 17 Nov 2010

View Version History

View License

This file contains the example code for the May 2003 News and Notes article "Importing Data via the Serial Object in MATLAB". The included M-code will read track log data from a Garmin eTrex GPS (Global Positioning Satellite) device and produce an analysis and visualization of that data. See the readme file (and the News and Notes article, posted on the MathWorks web site) for further details.

Cite As

Peter Webb (2021). Serial Object GPS Example Code (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (14)


how to access this file


Does anyone else have similar applications for DR / GPS? I mean for example the position of a vehicle using GPS which will cooperate with the DR and the results will be the processing of a Kalman filter

Da Na

work great,very cool

mie wryant

thanks for th files.
this very easy to use.
but i have problem with OpenGPS.m
the error message is
"??? Undefined function or method 'OpenGPS' for input arguments of type 'char'."

can you help me again please.

houssam SASSINE

Olivier Progin

Alon Alfa

"min" is a function and a var.
change the name of the function.

vimal patel

it is very good

Walter Allensworth

Well I got it reading data from my Garmin Etrex Legend in Matlab 6.1 after about 90 minutes of code debugging. There were many instances of '&&' in several functions where a single '&' were needed, and the final line in the sizeof.m function needs to be changed to:
s = getfield(typemap,type);

It's also a bit slow downloading the track-files, but that's OK.

Lastly, the analysis program has big trouble if you've got several dirrerent tracks in your GPS from different locations. So... you should clear it before capturing just the track you want.

What I was really looking for when I stumbled on this code is Matlab S/W that will read a NMEA string output from the GPS so I can store it in a file of my own format.

Is there code around to do that?


carlos rodrigues

I meed a funcion to read a serial port.
I meed to read data from de port.

Abdul Nasser

gathering information on matlab.

enes koytak

can anyone send me a matlab 6.5 version? it doesn't work :(

Mike Roberts

Works great, with a couple of tweaks for version 6.1. Very cool application.

Mike Roberts

Was using eTrex Legend and Matlab 6.1 - are the differences between 6.1 and 6.5 sufficient to prevent this from working ?

Looks like a very useful application base, if I could get it to work.

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!