diff --git a/topoplot/plotOneSubjectOneDay.m b/topoplot/plotOneSubjectOneDay.m index 4345542..c0f0049 100644 --- a/topoplot/plotOneSubjectOneDay.m +++ b/topoplot/plotOneSubjectOneDay.m @@ -20,7 +20,6 @@ subject=subjectsForNumbers{j}; fprintf('%s%i',subject,number) - [EEG,~]=readEEGSig(pathToFile,subject,number,maxFile); - - topoplot_Wrapper(EEG,eloc_file,stepSize,250) + [EEG,codes,samplingFrequency]=readEEGSig(pathToFile,subject,number,maxFile); + topoplot_Wrapper(EEG,codes,eloc_file,stepSize,samplingFrequency) end \ No newline at end of file diff --git a/topoplot/readEEGSig.m b/topoplot/readEEGSig.m index d24e945..04c9eed 100644 --- a/topoplot/readEEGSig.m +++ b/topoplot/readEEGSig.m @@ -1,10 +1,13 @@ -function [EEG,params]=readEEGSig(pathToFile,subject,number,maxFile) +function [EEG,codes,samplingFrequency]=readEEGSig(pathToFile,subject,number,maxFile) EEGcell=cell(maxFile,1); + codecell=cell(maxFile,1); for i=1:maxFile - [sig, ~, params] = load_bcidat(strcat(pathToFile,sprintf('%s/%s_B100%i/%s_B1S00%iR0%i.dat',subject,subject,number,subject,number,i))); + [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 a4951ae..52767ce 100644 --- a/topoplot/topoplot_Wrapper.m +++ b/topoplot/topoplot_Wrapper.m @@ -1,4 +1,4 @@ -function topoplot_Wrapper(EEG,eloc_file,stepSize,samplingFrequency) +function topoplot_Wrapper(EEG,codes,eloc_file,stepSize,samplingFrequency) % Wrapper for topoplot_martin() % Allows for plottig all EEG-Data of one timeline and sliding through them % @@ -8,28 +8,31 @@ % % stepSize - number of Datapoints the slider skips in one step (1 for none) % -% samplingFrequency - sampling frequency for the EEG data +% samplingFrequency - sampling frequency for the EEG data - slider=uicontrol('Style','slider','Min',1,'Max',fix(size(EEG,1)/stepSize),... - 'Value',1,'SliderStep',[stepSize/size(EEG,1),stepSize*10/size(EEG,1)],... - 'Callback',{@topoplotSlide,EEG,eloc_file,stepSize,samplingFrequency},... - 'Position',[10 10 450 20]); - - timeField=uicontrol('Style','edit','Callback',... - {@topoplotText,EEG,eloc_file,stepSize,samplingFrequency},... - 'Position',[460 10 50 20]); - text=uicontrol('Style','text','Position',[510 10 10 15]); - set(text,'String','s'); - - function topoplotSlide(source,~,EEG,eloc_file,stepSize,samplingFrequency) + +slider=uicontrol('Style','slider','Min',1,'Max',fix(size(EEG,1)/stepSize),... + 'Value',1,'SliderStep',[stepSize/size(EEG,1),stepSize*10/size(EEG,1)],... + 'Callback',{@topoplotSlide,EEG,codes,eloc_file,stepSize,samplingFrequency},... + 'Position',[10 10 450 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'); + + function topoplotSlide(source,~,EEG,codes,eloc_file,stepSize,samplingFrequency) idx=fix(stepSize*source.Value); set(timeField,'String',num2str(fix(idx/samplingFrequency))); + disp(codes(idx)) topoplot_martin(double(EEG(idx,:)),eloc_file) end - function topoplotText(source,~,EEG,eloc_file,stepSize,samplingFrequency) + function topoplotText(source,~,EEG,codes,eloc_file,stepSize,samplingFrequency) idx=fix(str2double(source.String)*samplingFrequency); set(slider,'Value',fix(idx/stepSize)); + disp(codes(idx)) topoplot_martin(double(EEG(idx,:)),eloc_file) end end \ No newline at end of file