addpath('/home/hohlochj/masterarbeit/usedMcode')
pathToFile='/nfs/wsi/ti/messor/hohlochj/origData/dirs.txt';
% pathToFile='/home/jph/Uni/masterarbeit/Block1_ReachingMovements/dirs.txt';

windowEMG=0.2;
windowEEG=1;
shift=0.2;
pburgOrder=50;
minEEGFreq=0;
maxEEGFreq=200;
k=10;
maxExpC=0;
maxPerClass=250;
EEG=true;
poolObj=parpool(32);

[subjects,numbers]=structForAllDays(pathToFile);
j=0;
for i=1:size(subjects,2)
    subject=subjects{i};
    for number=numbers{i}        
        j=j+1;
    end
end

meanAccurancysEMG=zeros([j,1]);
meanAccurancysEEG=zeros([j,1]);

j=1;
parfor i=1:size(subjects,2)
    subject=subjects{i};
    for number=numbers{i}
%         fprintf('%s%i\n',subject,number);
        readEEGEciton(subject,number,windowEMG,windowEEG,shift,5,7500,pburgOrder,minEEGFreq,maxEEGFreq);
        meanAccurancysEMG(j)=svmEciton(subject,number,false,k,maxExpC,maxPerClass);
        meanAccurancysEEG(j)=svmEciton(subject,number,EEG,k,maxExpC,maxPerClass);
        j=j+1;
    end
end
save(sprintf('/nfs/wsi/ti/messor/hohlochj/matlabData/%s_callAll.mat',datestr(datetime('now'))));
delete(poolObj)
