Newer
Older
masterarbeit / topoplot / topoplot_Wrapper.m
@JPH JPH on 9 Aug 2016 1 KB add topoplot
function topoplot_Wrapper(EEG,eloc_file,stepSize,samplingFrequency)
% Wrapper for topoplot_martin()
% Allows for plottig all EEG-Data of one timeline and sliding through them
    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)
        idx=fix(stepSize*source.Value);
        set(timeField,'String',num2str(fix(idx/samplingFrequency)));
        topoplot_martin(double(EEG(idx,:)),eloc_file)
    end

    function topoplotText(source,~,EEG,eloc_file,stepSize,samplingFrequency)
        idx=fix(str2double(source.String)*samplingFrequency);
        set(slider,'Value',fix(idx/stepSize));
        topoplot_martin(double(EEG(idx,:)),eloc_file)
    end
end