%rep=input('enter directory to work on \n','s'); 
files=dir(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\frances\data\modified\meanless\tr20dd\*dat']); 
volume_size=22;
el=[0.5;0.8;1.1;1.4;1.7;2.0;2.3;2.6;2.9;3.2;3.5;3.8;4.1;4.5;5.0;5.5;6.0;6.5;7.0;7.5;8.0;8.5];
%el=[0.75;2.25;3.75;5.25;6.75;8.25];
eli=0.5:0.2:8.5;
c=[290 300 310 320 330 340 350 0 10 20 30 40 50 60 70 80 90];
for cu=1:length(c)
    cut=c(cu);
for ii=1%:2
    rhi=[];
rhii=[];
    for fil=(ii-1)*volume_size+1:ii*volume_size;
        sweepfile=files(fil).name;
        mod_data=load(['C:\Documents and Settings\sylvie lorsolo\\My Documents\research\frances\data\modified\meanless\tr20dd\',sweepfile]);
        mod_az=mod_data(length(mod_data),:);
        mod_az=mod_az';
        mod_data=mod_data(1:length(mod_data)-1,:);
        dif=abs(cut-mod_az);
        azimuth=find(dif==min(dif));
        if length(azimuth) >1
            break
        end
        rhi=[rhi mod_data(:,azimuth)];
        
    end
%     for rg=1:150
%         temp=interp1(el,rhi(rg,:),eli,'linear');
%         rhii=[rhii;temp];
%     end
     rg=33.35:66.7:199*66.7+33.35;
%  [th,r]=meshgrid(deg2rad(eli'),rg);
%  [x,y]=pol2cart(th,r);
 [x,y,rhii]=new_rhi(el,rg,rhi);
 h=pcolor(x,y,rhii);
 shading interp
 v=[-5 5];
 caxis(v);
 colorbar
%     C = strcmp(rep,'tr20dd');
%     if C==0
       str_cut=num2str(cut);
         %save(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\frances\data\modified\meanless\tr20dd\rhi\',files((ii-1)*22+1).name,'_',str_cut,'.dat'],'rhii','eli','-ascii')
%     else
saveas(h,['C:\Documents and Settings\sylvie lorsolo\My Documents\research\frances\images\meanless\tr20dd\rhi\',files((ii-1)*22+1).name,'_',str_cut,'.jpg'])
%     end
end
end