displaytrack.m

来自「基于串行接口的GPS驱动程序」· M 代码 · 共 26 行

M
26
字号
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);


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?