Code covered by the BSD License  

Highlights from
Error-tolerant parsing of newline-delimited data

Error-tolerant parsing of newline-delimited data

by

 

Adaptive parsing of newline-separated data. Handles bad lines WITHOUT reading line-by-line.

adaptive_parse_init_demo(dataOrFid,initInfo,initOptions)
function [parsed,parsedPtrs] = adaptive_parse_init_demo(dataOrFid,initInfo,initOptions)
%
% adaptive_parse_init_demo.m--Initializing function for demonstrating use
% of adaptive_parse().
%
% The "initOptions" input argument is not used in this demo function, but
% it MUST appear in the function declaration.
%
% Syntax: [parsed,parsedPtrs] = adaptive_parse_init_demo(dataOrFid,initInfo,initOptions)

% Developed in Matlab 7.11.0.584 (R2010b) on GLNX86.
% Kevin Bartlett (kpb@uvic.ca), 2011-03-22 10:46
%-------------------------------------------------------------------------
    
parsed = [];
parsed.pressure = nan(1,initInfo.numExpectedLines);
parsed.pressure_mtime = nan(1,initInfo.numExpectedLines);
parsed.pressure_lineNumbers = nan(1,initInfo.numExpectedLines);
parsed.temperature = nan(1,initInfo.numExpectedLines);
parsed.temperature_mtime = nan(1,initInfo.numExpectedLines);
parsed.temperature_lineNumbers = nan(1,initInfo.numExpectedLines);
parsed.noiseAmplitude = nan(1,initInfo.numExpectedLines);
parsed.noiseAmplitude_mtime = nan(1,initInfo.numExpectedLines);
parsed.noiseAmplitude_lineNumbers = nan(1,initInfo.numExpectedLines);

parsedPtrs.pressure = 0;
parsedPtrs.pressure_mtime = 0;
parsedPtrs.pressure_lineNumbers = 0;
parsedPtrs.temperature = 0;
parsedPtrs.temperature_mtime = 0;
parsedPtrs.temperature_lineNumbers = 0;
parsedPtrs.noiseAmplitude = 0;
parsedPtrs.noiseAmplitude_mtime = 0;
parsedPtrs.noiseAmplitude_lineNumbers = 0;

Contact us