
% b=load('LIFECLEF2014_BIRDAMAZON_XC_WAV_RN9224.wav_T4_Q20_J40.dat');
a=dir('/NAS3/SABIOD/public_data/TRAINING_SET/BIRDS/');

b=fopen('newdataset.csv','r');
k=textscan(b,'%s','delimiter',',');
fclose(b);
k=[];
length(a)
FINAL=[];
for I=5:length(a)
I
if length(a(I).name)>30
try
b = load(['/NAS3/SABIOD/public_data/TRAINING_SET/BIRDS/',a(I).name(1:end-11),'_J40_Q20_T4/',a(I).name(1:end-11),'_T4_Q20_J40.dat']);
b=b(3:end-2,:);
med=mean(b(:))+1.2*std(b(:));
b=b>med;
%carre = reshape(b(:,1:68*floor(length(b)/68)),68,68,floor(length(b)/68));              
%crossF = std(carre(2:end,:,:),0,1)./mean(carre(2:end,:,:),1) ;
%crossT = std(carre(2:end,:,:),0,2)./mean(carre(2:end,:,:),2) ;
k=[];
for i=1:64
l=kolmo(b(i,:));
k=[k,l];
end
FINAL=[FINAL k'];
size(FINAL)
%mF = median(squeeze(crossF));                           
%mT = median(squeeze(crossT));     
%Cf=(std(std(carre(2:end,:,:)))./mean(mean(squeeze(carre(2:end,:,:)))));
%E=squeeze(std(sum(carre(2:end,:,:))))';
%R =(1./E).*(1./squeeze(Cf)').*  mF ./ mT ;

%R( median(squeeze(carre(1,:,:)))<0) =inf;                                           

%[ v iq ]= sort(R);                                      


%LISTE=[];
%i=0;
%while i<min(500,length(iq)-3)
%i=i+1;
%if iq(i)+3<size(carre,3)
%LISTE=[LISTE;reshape([carre(:,:,iq(i)),carre(:,:,iq(i)+1),carre(:,:,iq(i)+2),carre(:,:,iq(i)+3)],1,4624*4)];
%end

%size(LISTE,1)
%end

%save(['/NAS3/SABIOD/public_data/BIRDS_TEST_SET/',a(I).name(1:end-11),'_carres.dat'],'LISTE','-ascii')
catch
I
k=[];
for i=1:64
l=inf;
k=[k,l];
end
FINAL=[FINAL k'];

end
end
end
save(['/NAS3/SABIOD/public_data/BIRDS_TEST_SET/kolmo.dat'],'FINAL','-ascii')

