www.pudn.com > SerialGPS.zip > DisplayTrack.m
function DisplayTrack(port) % DISPLAYTRACK Display track log data from GPS on the given serial port % A program that uses the serial port follows a five-part pattern: % 1. Create a serial port object. % 2. Connect the serial port object to a device. % 3. Optionally set device properties. % 4. Communicate with the device (read and write data) % 5. Disconnect from the device and clean up % Connect to the GPS. This function implements parts 1-3 of the serial % object usage pattern. [gps, pid, version, text, protocols] = OpenGPS(port); % Get the track log data from the GPS (this is part 4 of the pattern) tracks = ReadTracks(gps); % Close the connection and clean up (part 5 of the pattern) CloseGPS(gps); % Analyze and display the track log data. Not part of the pattern, but a % program that reads data and does nothing with isn't very interesting. AnalyzeTracks(tracks);