function svmEciton(subject,number,EEG,k,maxExpC,maxPerClass)
    load(sprintf('/nfs/wsi/ti/messor/hohlochj/matlabData/%s%i200msWindowEMG1sWindowEEG200msShift1sPauseFreq0to200.mat',subject,number));
%    fprintf('%i,%i,%i',size(trainingDataEMG,1),size(trainingDataEEG,1),size(classification,1))
    addpath('/nfs/wsi/ti/messor/hohlochj/libsvm/matlab');

    %choose to estimate based on EEG or EMG
    if EEG
        trainingData=trainingDataEEG;
    else
        trainingData=trainingDataEMG;
    end
    clear trainingDataEEG;
    clear trainingDataEMG;
    
    accurancy=zeros(k,3);
    maxC=zeros(k,1);
    noClasses=size(unique(classification),1);
    cm=zeros(noClasses);
    randMap=randperm(size(trainingData,1));
    %disp('startCV')
    classes=classification; %necessary since otherwise classes are not passed to workers
    clear classification;
    parfor i=1:k
        leaveOut=trainingData(mod(randMap,k)==i-1,:,:);
        leaveClasses=classes(mod(randMap,k)==i-1);
        remaining=trainingData(mod(randMap,k)~=i-1,:,:);
        remainingClasses=classes(mod(randMap,k)~=i-1);
        %fprintf('%s create %ith model\n',datestr(datetime('now')),i)
        
        [model,maxC(i)]=kfoldCV(remainingClasses,remaining,k,maxExpC,maxPerClass);

        [predictions,accurancy(i,:),~]=svmpredict(leaveClasses,leaveOut(:,:),model);
        cm=cm+confusionmat(leaveClasses,predictions); %confusion matrix
    end
    meanAccurancy=mean(accurancy(:,1))

    fig=figure;
    cmScaled=zeros(size(cm));
    for i=1:size(cm,1)
        cmScaled(i,:)=cm(i,:)/sum(cm(i,:));
    end
    imagesc(cmScaled)
    colorbar();
    saveas(fig,sprintf('/nfs/wsi/ti/messor/hohlochj/plots/%s%i%icm200ms1sPause.fig',subject,number,EEG),'fig');
    save(sprintf('/nfs/wsi/ti/messor/hohlochj/matlabData/%s%i%i200ms1sPause.mat',subject,number,EEG),'meanAccurancy','maxC','cmScaled','-v7.3');
    fprintf('%s%i%i finished %s\n',subject,number,EEG,datestr(datetime('now')))
end
