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
%
%   EEG - consecutive EEG data (no of channels has to match the one 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,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