diff --git a/usedMcode/callAll.m b/usedMcode/callAll.m index 804c944..fee6808 100644 --- a/usedMcode/callAll.m +++ b/usedMcode/callAll.m @@ -7,7 +7,7 @@ noSynergies=4; allSubjects=false; %run all subjects and days or only one random day for one random subject - +name='differentShifts'; %suffix for the output, has to be valid name for file (no space, /, ...) windowEMG=0.2; windowEEG=1; shiftEMG=0.05; @@ -21,8 +21,7 @@ k=10; maxExpC=0; maxPerClass=250; -EEG=true; -poolObj=parpool(32); +poolObj=parpool(12); [subjects,numbers]=namesAndNumbers(pathToFile); numbersMat=cell2mat(numbers); @@ -78,9 +77,9 @@ number=numbersMat(j); subject=subjectsForNumbers{j}; savePath=readAll(pathToFile,subject,number,windowEMG,windowEEG,shiftEMG,shiftEEG,maxFile,threshold,pburgOrder,minEEGFreq,maxEEGFreq,pause,noLFsamples); -% [meanAccurancysEMG(j),maxCEMG(j,:),cmScaledEMG(j,:,:)]=svmEciton(savePath,'EMG',k,maxExpC,maxPerClass); -% [meanAccurancysEEG(j),maxCEEG(j,:),cmScaledEEG(j,:,:)]=svmEciton(savePath,'EEG',k,maxExpC,maxPerClass); -% [meanAccurancysLF(j),maxCLF(j,:),cmScaledLF(j,:,:)]=svmEciton(savePath,'LF',k,maxExpC,maxPerClass); + [meanAccurancysEMG(j),maxCEMG(j,:),cmScaledEMG(j,:,:)]=svmEciton(savePath,'EMG',k,maxExpC,maxPerClass); + [meanAccurancysEEG(j),maxCEEG(j,:),cmScaledEEG(j,:,:)]=svmEciton(savePath,'EEG',k,maxExpC,maxPerClass); + [meanAccurancysLF(j),maxCLF(j,:),cmScaledLF(j,:,:)]=svmEciton(savePath,'LF',k,maxExpC,maxPerClass); [correlationEMGkin(j,:),maxRidgeParamIndexEMGkin(j,:,:)]=ridgeCV(savePath,'EMG','kin',k,ridgeParams); [correlationEEGkin(j,:),maxRidgeParamIndexEEGkin(j,:,:)]=ridgeCV(savePath,'EEG','kin',k,ridgeParams); [correlationLFkin(j,:),maxRidgeParamIndexLFkin(j,:,:)]=ridgeCV(savePath,'LF','kin',k,ridgeParams); @@ -96,13 +95,13 @@ fprintf('%s%i finished %s\n',subject,number,datestr(datetime('now'))) end - save(strcat(pathToFile,sprintf('../matlabData/%s_callAll.mat',datestr(datetime('now'))))); + save(strcat(pathToFile,sprintf('../matlabData/%s_callAll-%s.mat',datestr(datetime('now'),name)))); else j=fix(rand()*size(numbersMat,2)+1); number=numbersMat(j); subject=subjectsForNumbers{j}; - savePath=readAll(pathToFile,subject,number,windowEMG,windowEEG,shiftEMG,shiftEEG,maxFile,threshold,pburgOrder,minEEGFreq,maxEEGFreq,pause,noLFsamples,EMGChannels,noSynergiesergies); + savePath=readAll(pathToFile,subject,number,windowEMG,windowEEG,shiftEMG,shiftEEG,maxFile,threshold,pburgOrder,minEEGFreq,maxEEGFreq,pause,noLFsamples,EMGChannels,noSynergies); [meanAccurancysEMG,maxCEMG,cmScaledEMG(:,:)]=svmEciton(savePath,'EMG',k,maxExpC,maxPerClass); [meanAccurancysEEG,maxCEEG,cmScaledEEG(:,:)]=svmEciton(savePath,'EEG',k,maxExpC,maxPerClass); [meanAccurancysLF,maxCLF,cmScaledLF(:,:)]=svmEciton(savePath,'LF',k,maxExpC,maxPerClass); @@ -120,7 +119,7 @@ [correlationLFnnmf,maxRidgeParamIndexLFnnmf(:,:)]=ridgeCV(savePath,'LF','NNMF',k,ridgeParams); fprintf('%s%i finished %s\n',subject,number,datestr(datetime('now'))) - save(strcat(pathToFile,sprintf('../matlabData/%s_call%s%i.mat',datestr(datetime('now')),subject,number))); + save(strcat(pathToFile,sprintf('../matlabData/%s_call%s%i-%s.mat',datestr(datetime('now')),subject,number,name))); end delete(poolObj) diff --git a/usedMcode/readAll.m b/usedMcode/readAll.m index c011a13..4dbf41b 100644 --- a/usedMcode/readAll.m +++ b/usedMcode/readAll.m @@ -54,7 +54,7 @@ smoothClassificationEEG=zeros([size(trainingDataEEG,1),1]); for i=1:size(smoothClassificationEEG,1) - smoothClassificationEEG(i)=mode(smoothClassificationEMG(fix(round(shiftEEG/shiftEMG*(i-1))+1):fix(round(shiftEEG/shiftEMG*i)))); + smoothClassificationEEG(i)=mode(smoothClassificationEMG(fix(round(shiftEEG/shiftEMG*(i-1))+1):min(fix(round(shiftEEG/shiftEMG*i)),max(size(smoothClassification))))); end trainingDataEEG=trainingDataEEG(smoothClassificationEEG~=-1,:,:);