diff --git a/topoplot/plotOneSubjectOneDay.m b/topoplot/plotOneSubjectOneDay.m index c0f0049..f49bdfe 100644 --- a/topoplot/plotOneSubjectOneDay.m +++ b/topoplot/plotOneSubjectOneDay.m @@ -2,24 +2,56 @@ pathToFile='/home/jph/Uni/masterarbeit/origData/'; eloc_file='/home/jph/Uni/masterarbeit/topoplot/electrocaps_all.locs'; maxFile=5; - stepSize=250; + stepSize=1; - [subjects,numbers]=namesAndNumbers(pathToFile); - numbersMat=cell2mat(numbers); - subjectsForNumbers=cell(size(numbersMat,2),1); - j=1; - for i=1:size(subjects,2) - subject=subjects{i}; - for number=numbers{i} - subjectsForNumbers{j}=subject; - j=j+1; - end - end - j=fix(rand()*size(numbersMat,2)+1); - number=numbersMat(j); - subject=subjectsForNumbers{j}; - fprintf('%s%i',subject,number) +% [subjects,numbers]=namesAndNumbers(pathToFile); +% numbersMat=cell2mat(numbers); +% subjectsForNumbers=cell(size(numbersMat,2),1); +% j=1; +% for i=1:size(subjects,2) +% subject=subjects{i}; +% for number=numbers{i} +% subjectsForNumbers{j}=subject; +% j=j+1; +% end +% end +% j=fix(rand()*size(numbersMat,2)+1); +% number=numbersMat(j); +% subject=subjectsForNumbers{j}; +% fprintf('%s%i',subject,number) - [EEG,codes,samplingFrequency]=readEEGSig(pathToFile,subject,number,maxFile); - topoplot_Wrapper(EEG,codes,eloc_file,stepSize,samplingFrequency) + subject='FS'; + number=3; + + maxFile=5; + threshold=10000; %EMG is classified as movement + EMGChannels={'AbdPolLo','Biceps','Triceps','FrontDelt','MidDelt','BackDelt'}; + noSynergies=3; + noLFsamples=5; + pause=false; + pburgOrder=250; + windowEMG=0.2; + windowEEG=1; + shiftEMG=0.05; + shiftEEG=0.2; + minEEGFreq=2; + maxEEGFreq=49; + + + savePath=readAll(pathToFile,subject,number,windowEMG,windowEEG,shiftEMG,shiftEEG,maxFile,... + threshold,pburgOrder,minEEGFreq,maxEEGFreq,pause,noLFsamples,EMGChannels,noSynergies); + + load(savePath) + clear trainingDataEMG; + clear trainingDataEEGlf; + clear classifiactionEMG; + clear kinematics; + clear synergies*; + + meanRest=squeeze(mean(trainingDataEEG(classificationEEG==0,:,minEEGFreq:maxEEGFreq),1)); + meanMove=squeeze(mean(trainingDataEEG(classificationEEG>0,:,minEEGFreq:maxEEGFreq),1)); + + samplingFrequency=1; + + topoplot_Wrapper((meanMove./meanRest - 1)',minEEGFreq:maxEEGFreq,eloc_file,stepSize,samplingFrequency) end \ No newline at end of file diff --git a/topoplot/readEEGSig.m b/topoplot/readEEGSig.m deleted file mode 100644 index 04c9eed..0000000 --- a/topoplot/readEEGSig.m +++ /dev/null @@ -1,13 +0,0 @@ -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 \ No newline at end of file diff --git a/topoplot/topoplot_Wrapper.m b/topoplot/topoplot_Wrapper.m index 52767ce..83e26a1 100644 --- a/topoplot/topoplot_Wrapper.m +++ b/topoplot/topoplot_Wrapper.m @@ -2,7 +2,7 @@ % Wrapper for topoplot_martin() % Allows for plottig all EEG-Data of one timeline and sliding through them % -% EEG - consecutive EEG data (no of channels has to match the one in eloc_file) +% EEG - consecutive EEG data (no of channels has to match the number in eloc_file) % % eloc_file - path to the eloc-file, type topoplot_martin('demo') for an example % @@ -19,20 +19,20 @@ timeField=uicontrol('Style','edit','Callback',... {@topoplotText,EEG,codes,eloc_file,stepSize,samplingFrequency},... 'Position',[460 10 50 20]); -text=uicontrol('Style','text','Position',[510 10 10 15]); -set(text,'String','s'); +text=uicontrol('Style','text','Position',[510 10 30 15]); +set(text,'String','Hz'); function topoplotSlide(source,~,EEG,codes,eloc_file,stepSize,samplingFrequency) idx=fix(stepSize*source.Value); set(timeField,'String',num2str(fix(idx/samplingFrequency))); - disp(codes(idx)) + %disp(codes(idx)) topoplot_martin(double(EEG(idx,:)),eloc_file) end function topoplotText(source,~,EEG,codes,eloc_file,stepSize,samplingFrequency) idx=fix(str2double(source.String)*samplingFrequency); set(slider,'Value',fix(idx/stepSize)); - disp(codes(idx)) + %disp(codes(idx)) topoplot_martin(double(EEG(idx,:)),eloc_file) end end \ No newline at end of file