clear

directory = 'N:/DeploymentOct12-09/R2009-285-08-00-26/R00000';
startDate = '12-Oct-2009 01:20:00';
dnStartDate = datenum(startDate);

Fs = 27e6 / 512;
Nfft = 1024;
window = hanning(Nfft);
Noverlap = 0.5 * Nfft;

numSections = 8;

D = dir(directory);
fileNames = {D(3:length(D)).name};
fileDates = {D(3:length(D)).date};

for i=1:1
    dnFileDate = datenum(fileDates(i));
    if ((dnFileDate >= dnStartDate) && strncmp(fileNames(i), 'D', 3))
        tic
        fid = fopen(strcat(directory,'\',char(fileNames(i))));
        fprintf('Processing file: %s   %s\n',strcat(directory,'\',char(fileNames(i))),char(fileDates(i)));
        for j=1:numSections
            i
            ADCData(:,i) = fread(fid, 'int16');
            Pxx(i,:) = pwelch(ADCData(j,:), window, Noverlap, Nfft);
        end
        fclose(fid);
        toc
    end
end

time=0:1/Fs:(length(data(1,:))-1)/Fs;




        
        
        
        


