1
function serialData = PR670read
2
% PR670read - Read data from the PR-670.
5
% serialData = PR670read
8
% Reads data chars from PR-670 until there is nothing left. Returns an
9
% empty matrix if there is nothing to read.
12
% serialData (1xN char) - Data read from the PR-50.
16
if isempty(g_serialPort)
17
error('Meter has not been initialized.');
20
% Look for any data on the serial port.
21
serialData = char(IOPort('Read', g_serialPort));
23
% If data exists keep reading off the port until there's nothing left.
24
if ~isempty(serialData)
26
while ~isempty(tmpData)
28
tmpData = char(IOPort('Read', g_serialPort));
29
serialData = [serialData, tmpData]; %#ok<AGROW>