function [EEG,codes,samplingFrequency]=readEEGSig(pathToFile,subject,number,maxFile)
    EEGcell=cell(maxFile,1);
    codecell=cell(maxFile,1);
    
    for i=1:maxFile
        [sig, stat, params] = load_bcidat(strcat(pathToFile,sprintf('%s/%s_B100%i/%s_B1S00%iR0%i.dat',subject,subject,number,subject,number,i)),'-calibrated');
        EEGcell{i}=sig(:,1:32);
        codecell{i}=stat.StimulusCode;
    end
    samplingFrequency=params.SamplingRate.NumericValue;
    EEG=cell2mat(EEGcell);
    codes=cell2mat(codecell);
end