function [tgwind,tke,mean_corr]=turb_corr_analys(input_data,max_file)
turb=[];
refle=[];
radi=[];
verti=[];
speed=[];
more_days='y';
h1=45;
xmin=26;
while strcmp(more_days,'y')==1
    for file_number=1:2:max_file
        input_data.file_number=file_number;
        [ws,radwind,tangwind,w,dbz, x_fill, y_fill, z_fill, type_data]=read_w_files(input_data);
        
        
        
        if type_data == 0
            
            refle=[refle;dbz(:,1:h1)];
            verti=[verti;w(:,1:h1)];
            radi=[radi;radwind(:,1:h1)];
            speed=[speed;tangwind(xmin:end,1:h1)];
        else 
            
            turb=[turb;(dbz(xmin:end,1:h1)).^2];
        end
        input_data.file_number=input_data.file_number + 1;
        [ws,radwind,tangwind,w,dbz, x_fill, y_fill, z_fill, type_data]=read_w_files(input_data);
        if type_data == 0
            speed=[speed;tangwind(xmin:end,1:h1)];
            refle=[refle;dbz(:,1:h1)];
            verti=[verti;w(:,1:h1)];
            radi=[radi;radwind(:,1:h1)];
        else 
            
            turb=[turb;(dbz(xmin:end,1:h1)).^2];
        end
    end
    
    [m,n]=size(speed);
    
    tgwind=reshape(speed,m*n,1);
%     reflec=reshape(refle,m*n,1);
    tke=reshape(turb,m*n,1);
    mean_corr=corrcoef(tke,tgwind,'rows','complete')
    c=num2str(mean_corr(2,1))
    
   more_days=input('Do you want to process another day y/n  ?','s');
    if strcmp(more_days,'y')==1
        input_data.hurricane=input('Enter the new storm  ','s');
        input_data.jour=input('Enter the new date  ','s');
        maxi=input('Enter number of files to process','s');
        max_file=str2num(maxi);
    end
end


% figure
% h=plot(tgwind,tke,'.')
% xlabel('Tangential Wind (m.s^{-1})')
% ylabel('TKE (m^2.s^{-2})')
% title(['TKE dependence on Tangential Wind for ',input_data.hurricane(5:length(input_data.hurricane))])
% gtext(c) 
%  saveas(h,['C:\Documents and Settings\lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\TKE\profiles\scatter_tg_',input_data.hurricane(5:length(input_data.hurricane)),'10km','.fig']);
%  saveas(h,['C:\Documents and Settings\lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\TKE\profiles\scatter_tg_',input_data.hurricane(5:length(input_data.hurricane)),'10km','.png']);   
% 
% 
% 
