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: spm_cfg_eeg_artefact.m
    path of file: ./repos/spm12/config
    
    the code of the file until where you have to start completion: function artefact = spm_cfg_eeg_artefact
% Configuration file for M/EEG artefact detection
%__________________________________________________________________________
% Copyright (C) 2008-2016 Wellcome Trust Centre for Neuroimaging

% Vladimir Litvak
% $Id: spm_cfg_eeg_artefact.m 7085 2017-06-01 10:42:01Z vladimir $


%--------------------------------------------------------------------------
% D
%--------------------------------------------------------------------------
D        = cfg_files;
D.tag    = 'D';
D.name   = 'File Name';
D.filter = 'mat';
D.num    = [1 1];
D.help   = {'Select the M/EEG mat file.'};

%--------------------------------------------------------------------------
% mode
%--------------------------------------------------------------------------
mode = cfg_menu;
mode.tag = 'mode';
mode.name = 'Mode';
mode.labels = {'Reject', 'Mark'};
mode.val = {'reject'};
mode.values = {'reject', 'mark'};
mode.help = {'Action mode reject - to set trials and channels as bad',...
    'mark - just create artefact events, set channels as bad if mostly artefactual.'};

%--------------------------------------------------------------------------
% badchanthresh
%--------------------------------------------------------------------------
badchanthresh         = cfg_entry;
badchanthresh.tag     = 'badchanthresh';
badchanthresh.name    = 'Bad channel threshold';
badchanthresh.strtype = 'r';
badchanthresh.num     = [1 1];
badchanthresh.val     = {0.2};
badchanthresh.help    = {'Fraction of trials with artefacts ', ...
    'above which an M/EEG channel is declared as bad.'};

%--------------------------------------------------------------------------
% methods

    
function artefact = spm_cfg_eeg_artefact
% Configuration file for M/EEG artefact detection
%__________________________________________________________________________
% Copyright (C) 2008-2016 Wellcome Trust Centre for Neuroimaging

% Vladimir Litvak
% $Id: spm_cfg_eeg_artefact.m 7085 2017-06-01 10:42:01Z vladimir $


%--------------------------------------------------------------------------
% D
%--------------------------------------------------------------------------
D        = cfg_files;
D.tag    = 'D';
D.name   = 'File Name';
D.filter = 'mat';
D.num    = [1 1];
D.help   = {'Select the M/EEG mat file.'};

%--------------------------------------------------------------------------
% mode
%--------------------------------------------------------------------------
mode = cfg_menu;
mode.tag = 'mode';
mode.name = 'Mode';
mode.labels = {'Reject', 'Mark'};
mode.val = {'reject'};
mode.values = {'reject', 'mark'};
mode.help = {'Action mode reject - to set trials and channels as bad',...
    'mark - just create artefact events, set channels as bad if mostly artefactual.'};

%--------------------------------------------------------------------------
% badchanthresh
%--------------------------------------------------------------------------
badchanthresh         = cfg_entry;
badchanthresh.tag     = 'badchanthresh';
badchanthresh.name    = 'Bad channel threshold';
badchanthresh.strtype = 'r';
badchanthresh.num     = [1 1];
badchanthresh.val     = {0.2};
badchanthresh.help    = {'Fraction of trials with artefacts ', ...
    'above which an M/EEG channel is declared as bad.'};

%--------------------------------------------------------------------------
% methods
%--------------------------------------------------------------------------
artefact_funs = spm_select('List',spm('dir'),'^spm_eeg_artefact_.*\.m$');
artefact_funs = cellstr(artefact_funs);

fun      = cfg_choice;
fun.tag  = 'fun';
fun.name = 'Detection algorithm';
fun.values = cell(1,numel(artefact_funs));
for i = 1:numel(artefact_funs)
    fun.values{i} = feval(spm_file(artefact_funs{i},'basename'));
end