Newer
Older
masterarbeit / CD / matlabCode / topoplot / topoplot_Wrapper.m
@Jan-Peter Hohloch Jan-Peter Hohloch on 22 Nov 2016 1 KB final
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
%
%   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
%
%   stepSize - number of Datapoints the slider skips in one step (1 for none)
%
%   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,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 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))
        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))
        topoplot_martin(double(EEG(idx,:)),eloc_file)
    end
end