Code covered by the BSD License  

Highlights from
Realterm communications suite

Realterm communications suite

by

 

06 Jan 2010 (Updated )

Use Realterm in a similar way to using the MATLAB "serial" commands and instrument control toolbox.

realtermfgetl(handle, captureFileID, terminator, timeOut, varargin)
function output = realtermfgetl(handle, captureFileID, terminator, timeOut, varargin)
% REALTERMFGETL reads out a "line" up to the terminator specified, but
% excludes the terminator from the output.  This is essentially a wrapper
% for realtermfscanf, with only a minor change to the outputs.

% reads out a line
output = realtermfscanf(handle, captureFileID, terminator, timeOut, varargin);

% define the range where the terminator might be
terminatorRange = (numel(output) - numel(terminator) + 1) : numel(output);

% if the end of the line matches the terminator, then remove those
if strcmp(output(terminatorRange), terminator)
    
    % then remove those parts
    output = output(1:end - numel(terminator));
end

Contact us