function [wavedir,date]=Readwavedir(filename)

lines = importdata(filename);

for i_l=1:length(lines)
date(i_l)=datenum(lines{i_l}(1:17) , 'dd-mm-yy HH:MM:SS');
 if length(lines{i_l}) == 24 & length(lines{i_l}) < 30   % void lines with no data (02-05-09 11:00:00 > /0) or bad data (02-05-09 11:00:00 > -999999999/11)
     wavedir(i_l)=str2num(lines{i_l}(end-4:end-3));  % put it in m
 elseif   length(lines{i_l}) > 24 & length(lines{i_l}) < 30
     wavedir(i_l)=str2num(lines{i_l}(end-5:end-3));  % put it in m
 else
     wavedir(i_l)=NaN;
 end
end

if 0
    plot(date,wavedir)
    datetick('x')
end