You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: erplab_eegscanner.m
    path of file: ./repos/erplab/functions
    
    the code of the file until where you have to start completion: % erplab_eegscanner
%
% PURPOSE: checks EEG dataset according to set of criteria
% Format:
% serror = erplab_eegscanner(EEG, funcname, chckmultieeg, chckemptyeeg, chckepocheeg, chckeventlist)
%
% Inputs:
%
% EEG           - EEGLAB dataset
% funcname      - function name that calls erplab_eegscanner.
%
% Criteria:
% chckmultieeg  = check for multiple dataset (md).    0= do not accept md;    1=accept only md;  2=do not care
% chckemptyeeg  = check for empty dataset (ed).       0= do not accept ed;    1=accept only ed;  2=do not care
% chckepocheeg  = check for epoched dataset (epd).    0= do not accept epd
    
function name that calls erplab_eegscanner.
%
% Criteria:
% chckmultieeg  = check for multiple dataset (md).    0= do not accept md;    1=accept only md;  2=do not care
% chckemptyeeg  = check for empty dataset (ed).       0= do not accept ed;    1=accept only ed;  2=do not care
% chckepocheeg  = check for epoched dataset (epd).    0= do not accept epd;   1=accept only epd; 2=do not care
% chcknoevents  = check for no event codes (ev).      0= do not accept if no event   1=accept if no events; 
% chckeventlist = check for EVENTLIST structure (ES). 0= do not accept ES;    1=accept only ES;  2=do not care
%
% Option (parameter-value)
%
% 'ErrorMsg'   - 'popup': display popup window with error message when criteria are not met
%              - 'error': display error message (command window) when criteria are not met
%              - 'off'  ; % do not display error msg (just get outcome through "serror")
%
%
% Output:
% serror        - 0 means Ok.no problem found. 1 means criteria were not met.
%
%
% *** This function is part of ERPLAB Toolbox ***
% Author: Javier Lopez-Calderon
% Center for Mind and Brain
% University of California, Davis,
% Davis, CA
% 2009

function serror = erplab_eegscanner(EEG, funcname, chckmultieeg, chckemptyeeg, chckepocheeg, chcknoevents, chckeventlist, varargin)

serror = 0; % no problem by default
if nargin<1
        help erplab_eegscanner
        return
end