
% reads in hf30lfux files files and writes out
% one datafile with all of the pertinent info in it.

disp('Reading hf30 files')

clear
read_parameters_stratus

% clear all;
fclose('all');
s=[way_proc_data_flux 'flux_30*.txt'];
dr=dir(s);			%lists all files in directory
[n m]=size(dr);
nx=n;%				%# of files in data directory (includes . and ..)     
%stux_all=zeros(100,29);

%******************  setup read data loop  **********
ss=way_proc_data_flux;
jamx=1;
for ibg = 1:n;%nx 			%major read loop
   nm=dr(ibg).name
    if(nm(1:9)=='flux_30hf' & length(nm)<17)
        e=[ss dr(ibg).name]; %gets names of files in directory
        stux=load(e);   		%loads all data from files into stux
        [nl ml]=size(stux);
        stux_alla(jamx:jamx+nl-1,1:31)=stux;  % make data array
        jamx=jamx+nl;  
    end;
end; %  data line loop

stux_all=sortrows(stux_alla,1);
% save [way_proc_data, 'flux_30hf_' cruise year(3:4) '.txt'] stux_all -ascii -tabs
save([way_proc_data_flux, 'flux_30hf_' cruise year(3:4) '.txt'],'stux_all','-ascii','-tabs')
