%disp('prt_mainfile_4');
fclose('all');
%This program takes data computed by the make_data_file progam and creates an ascii
%file appropriate for reading into a spreadsheet (e.g., lotus, quatropro, etc)
%To use it, you must first run the make_data_file program, or stick this stuff in it

prt_it=1;  %set to 0 to print to screen, 1 to print to a file (i.e., make ascii file)
if prt_it==1
   e='D:\matlabstf\cwf\sheba_proc\main_file_prf4.txt';
   flist=fopen(e,'a');
else
   flist=1;
end; 
%take stats data and stick into matrix
jazz(1)=jd_son(j);%decimal JD
jazz(2:6)=z(j,1:5);%height
jazz(7:11)=min(99.9,ws(j,1:5));%wind speed (m/s)
jazz(12:16)=min(360,wd(j,1:5));%wind direction 
jazz(17:21)=Th(1:5,i);%temp(C)
jazz(22:26)=Qx(1:5,i);%mixing ratio (g/kg)
jazz(27:31)=sign(us(j,1:5)).*min(99.9,abs(us(j,1:5)));%ustar (m/s)
jazz(32:36)=sign(hs(j,1:5)).*min(999,abs(hs(j,1:5)));%sensible heat flux (W/m2)
jazz(37:41)=min(99.9,sigu(j,1:5));%
jazz(42:46)=min(99.9,sigv(j,1:5));%
jazz(47:51)=min(99.9,sigw(j,1:5));%
jazz(52:56)=min(99.9,sigT(j,1:5));%
jazz(57:61)=min(9.99,Cu(j,1:5));%
jazz(62:66)=min(9.99,Cv(j,1:5));%
jazz(67:71)=min(9.99,Cw(j,1:5));%
jazz(72:76)=min(9.99,CT(j,1:5));%
jazz(77:81)=fl(j,1:5);%
%vectorized print, 20 columns, 1 rows

fprintf(flist,'%9.4f  %8.2f %8.2f %8.2f %8.2f %8.2f  %8.2f %8.2f %8.2f %8.2f %8.2f  %9.2f %9.2f %9.2f %9.2f %9.2f  %8.2f %8.2f %8.2f %8.2f %8.2f  %8.2f %8.2f %8.2f %8.2f %8.2f  %9.3f %9.3f %9.3f %9.3f %9.3f  %8.2f %8.2f %8.2f %8.2f %8.2f  %9.3f %9.3f %9.3f %9.3f %9.3f  %9.3f %9.3f %9.3f %9.3f %9.3f  %9.3f %9.3f %9.3f %9.3f %9.3f  %9.3f %9.3f %9.3f %9.3f %9.3f  %9.3f %9.3f %9.3f %9.3f %9.3f  %9.3f %9.3f %9.3f %9.3f %9.3f  %9.3f %9.3f %9.3f %9.3f %9.3f  %9.3f %9.3f %9.3f %9.3f %9.3f  %9.1f %9.1f %9.1f %9.1f %9.1f\r',jazz);
	
%fprintf(flist,'%16.4\r',jazz);




fclose('all');
