function [sig_wave_ht,wave,timer,jd_wave,amplitude]=Riegl_reader(e,ddd,hhh)

% read_wave
% Reads Riegl 10Hz laser range meter for wave height. (slow)
clear temp stx;
flist=fopen(e,'r');
stx=[];temp=[];

if flist>0
	while ~feof(flist) % end-of-file not reached
            temp=textscan(flist,'%2f%2f%3f %*f%f %*f%f %*f%f %*[^\n]','headerLines',1,'delimiter','; ','emptyValue',NaN,'treatAsEmpty',{'r','a','q'});
            stx=[stx cell2mat(temp)'];
    end;
else
    stx=ones(6,36000)*NaN;
end

minu=stx(1,:);
sec=stx(2,:);
msec=stx(3,:);
wave=stx(4,:);
amplitude=stx(5,:);

jd_wave=ddd + (hhh+(minu+(sec+msec/1000)/60)/60)/24;
timer=minu*60+sec+msec/1000;
clear minu sec msec

[b, m, n] = unique(timer);
timer=timer(m);
wave=wave(m);
amplitude=amplitude(m);

mwave=nanmedian(wave);
wave=wave-mwave;
sig_wave_ht=4.*sqrt(nanvar(wave));
  
clear mwave stx temp
fclose all;
  
  
  