close all
clear all


Year = [];
Month = [];
Day =  [];
H_s = [];
T_p = [];

files = dir('*.txt');
for n = 1:length(files)
    
    filenm = files(n).name;               %#YY  MM DD hh mm WDIR WSPD GST  WVHT   DPD   APD MWD   PRES  ATMP  WTMP  DEWP  VIS  TIDE
                                          %#yr  mo dy hr mn degT m/s  m/s     m   sec   sec deg    hPa  degC  degC  degC  nmi    ft
   [yr,mo,day,height,period_d,period_a,direction] = textread(filenm,'%d %d %d %*d %*d %*f %*f %*f %f %f %f %f %*f %*f %*f %*f %*f %*f %*f','headerlines',2);
   
   n
   mean(height)
   
   
   i = find(99.0-height);
   H_s = [H_s height(i)'];
   Year = [Year yr(i)'];
   Month = [Month mo(i)'];
   Day = [Day day(i)'];
   T_p = [T_p period_d(i)'];
   
   clear i height yr mo day period_d;
   
end

