from
EKKOREAD
by Ian Howat
Import WinEkko ascii GPR data files with header info.
|
| ekkoread(datafile,varargin)
|
function [x,t,A,hdr] = ekkoread(datafile,varargin)
% EKKOREAD Import a WinEKKO Ground Penetrating Radar File (.as2).
% [x,t,A] = EKKOREAD('FILE') reads an ascii Sensors & Software WinEkko
% export file (.as2 extension). Output values are:
% x: vector of trace positions in x direction.
% t: vector of travel times
% A: apmlitude data array
% hdr: srtucture array of parameters from headerfile in field .name and
% .value (empty if no headerfile exists).
%
% EKKOREAD('FILE','HEADERFILE') uses the specified headerfile. Default =
% 'FILE.dh'.
%
% Ian M. Howat, Applied Physics Lab, University of Washington
% ihowat@apl.washington.edu
% Version 1: 06-Oct-2005
A= DLMREAD(datafile,' ',1,0);
t = A(:,1); A(:,1) = [];
x = str2num(fgetl(fopen(datafile))); fclose all;
if isempty(varargin)
headerfile = [datafile(1:find(datafile == '.')),'hd'];
else
headerfile = varargin;
end
if ~exist(headerfile,'file')
disp('>> Header file does not exist, no header information returned');
hdr = [];
else
fid = fopen(headerfile);
i=1;
while i
line = fgetl(fid);
if ~isempty(line);
if line == -1;
break
elseif ~isempty(find(line == '=')) && isempty(str2num(line(1)))
hdr(i).name = line(1:find(line == '=')-1);
tmp = line(find(line == '=')+1:end);
if isempty(str2num(tmp))
hdr(i).value = tmp;
else
hdr(i).value = str2num(tmp);
end
i =i+1;
end
end
end
end
fclose all;
|
|
Contact us at files@mathworks.com