function compare_center

fid=fopen('resultats_distance.dat','a')
hurricane(1).name='katrina';
hurricane(2).name='isabel';
hurricane(3).name='rita';
hurricane(4).name='frances';
hurricane(5).name='ivan';

for i=1:5
    
    input_data.hurricane=hurricane(i).name
    int_dir=dir(['C:\Documents and Settings\lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\TKE\',input_data.hurricane]);
    temp=[];
    L=length(int_dir);
    for j=1:L
        temp=[temp;int_dir(j).isdir];
    end
    u_dir=find(temp==1);
    if length(u_dir)>2
        for k=3:length(u_dir)
            input_data.jour=int_dir(k).name
            disp(['starting',input_data.jour,'for',input_data.hurricane])
            
            
            
            filename=dir([['C:\Documents and Settings\lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\TKE\',input_data.hurricane,'\',input_data.jour(1:2)],'\*leg*.dat']) 
            
            L2=length(filename);
            
            for ll=1:L2
                fichier=['C:\Documents and Settings\lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\TKE\',input_data.hurricane,'\',input_data.jour(1:2),'\',filename(ll).name]
                
                
                leg_data=textread(fichier,'%s','bufsize', 8191);
                
                lat_peter=str2num(cell2mat(leg_data(10)))
                long_peter=str2num(cell2mat(leg_data(11)))
                
                lat_wc=str2num(cell2mat(leg_data(33)))
                long_wc=str2num(cell2mat(leg_data(34)))
                
                dist_center=distdim(distance(lat_peter,long_peter,lat_wc,long_wc),'deg','km');
                
                s=[input_data.hurricane,'       ', input_data.jour(1:2) ,'      ',cell2mat(leg_data(7)),'     ', num2str(dist_center)];
                
                fprintf(fid,'%s \r',s)
                path1=['C:\Documents and Settings\lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\TKE\',input_data.hurricane,'\',input_data.jour(1:2),'\'];
                
            end
        end
    end
end

fclose(fid)