close all
clear all


Year = [];
Month = [];
Day =  [];
Hour = [];
Min = [];
H_s = [];
T_p = [];
T_a = [];
Direction = [];
Temp = [];

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,hour,min,height,period_peak,direction,period_avg,temp] = textread(filenm,'%d %d %d %d %d %f %f %d %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)'];
   Hour = [Hour hour(i)'];
   Min = [Min min(i)'];
   
   T_p = [T_p period_peak(i)'];
   T_a = [T_a period_avg(i)'];
   
   Direction = [Direction direction(i)'];
   
   Temp = [Temp temp(i)'];

   
   
   clear i height yr mo day hour min period_peak period avg;
   
end

