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: test_tutorial_nirs_multichannel20191023.m
    path of file: ./repos/fieldtrip/test
    
    the code of the file until where you have to start completion: function test_tutorial_nirs_multichannel20191023

% WALLTIME 00:10:00
% MEM 2gb
% DEPENDENCY ft_datatype_sens ft_nirs_transform_ODs ft_nirs_prepare_ODtransformation
% DATA public

%%
% this reflects the "Preprocessing and averaging of multi-channel NIRS data" tutorial
% obtained from http://www.fieldtriptoolbox.org/tutorial/nirs_multichannel/ at 23 October 2019
% most of the comments have been removed to make this MATLAB script easier to read

cd(dccnpath('/home/common/matlab/fieldtrip/data/ftp/tutorial/nirs_multichannel'));

%% ## Read data and downsample

cfg             = [];
cfg.dataset     = 'LR-01-2015-06-01-0002.oxy3';
data_raw        = ft_preprocessing(cfg);

cfg      = [];
cfg.opto = 'LR-01-2015-06-01-0002.oxy3';
ft_layoutplot(cfg);

%% ### Trigger channels

find(strcmp(data_raw.label,'ADC001'))
find(strcmp(data_raw.label,'ADC002'))

figure; hold on

plot(data_raw.time{1}, data_raw.trial{1}(97,:)*1.0, 'b-')
plot(data_raw.time{1}, data_raw.trial{1}(98,:)*1.1, 'r:')

event = ft_read_event('LR-01-2015-06-01-0002.oxy3');

data_raw.fsample

cfg                   = [];
cfg.resamplefs        = 10;
data_down             = ft_resampledata(cfg, data_raw);

cfg                = [];
cfg.preproc.demean = 'yes';
cfg.viewmode       = 'vertical';
cfg.continuous     = 'no';
cfg.ylim           = [ -0.003   0.003 ];
cfg.channel        = 'Rx*'; % only show channels starting with Rx
ft_databrowser(cfg, data_down);

cfg                 = [];
cfg.hpfilter        = 'yes';
cfg.hpfreq          = 0.01;
data_flt            = ft_preprocessing(cfg,data_down);

cfg                = [];
cfg.preproc.demean = 'yes';
cfg.viewmode       = 'vertical';
cfg.continuous     = 'no';

    
function test_tutorial_nirs_multichannel20191023

% WALLTIME 00:10:00
% MEM 2gb
% DEPENDENCY ft_datatype_sens ft_nirs_transform_ODs ft_nirs_prepare_ODtransformation
% DATA public

%%
% this reflects the "Preprocessing and averaging of multi-channel NIRS data" tutorial
% obtained from http://www.fieldtriptoolbox.org/tutorial/nirs_multichannel/ at 23 October 2019
% most of the comments have been removed to make this MATLAB script easier to read

cd(dccnpath('/home/common/matlab/fieldtrip/data/ftp/tutorial/nirs_multichannel'));

%% ## Read data and downsample

cfg             = [];
cfg.dataset     = 'LR-01-2015-06-01-0002.oxy3';
data_raw        = ft_preprocessing(cfg);

cfg      = [];
cfg.opto = 'LR-01-2015-06-01-0002.oxy3';
ft_layoutplot(cfg);

%% ### Trigger channels

find(strcmp(data_raw.label,'ADC001'))
find(strcmp(data_raw.label,'ADC002'))

figure; hold on

plot(data_raw.time{1}, data_raw.trial{1}(97,:)*1.0, 'b-')
plot(data_raw.time{1}, data_raw.trial{1}(98,:)*1.1, 'r:')

event = ft_read_event('LR-01-2015-06-01-0002.oxy3');

data_raw.fsample

cfg                   = [];
cfg.resamplefs        = 10;
data_down             = ft_resampledata(cfg, data_raw);

cfg                = [];
cfg.preproc.demean = 'yes';
cfg.viewmode       = 'vertical';
cfg.continuous     = 'no';
cfg.ylim           = [ -0.003   0.003 ];
cfg.channel        = 'Rx*'; % only show channels starting with Rx
ft_databrowser(cfg, data_down);

cfg                 = [];
cfg.hpfilter        = 'yes';
cfg.hpfreq          = 0.01;
data_flt            = ft_preprocessing(cfg,data_down);

cfg                = [];
cfg.preproc.demean = 'yes';
cfg.viewmode       = 'vertical';
cfg.continuous     = 'no';
cfg.ylim           = [ -0.003   0.003 ];
cfg.channel        = 'Rx*'; % only show channels starting with Rx
ft_databrowser(cfg, data_flt);

%% ## Epoch

event = ft_read_event('LR-01-2015-06-01-0002.oxy3');

adc001 = find(strcmp({event.type}, 'ADC001'));
adc002 = find(strcmp({event.type}, 'ADC002'));

% get the sample number in the original data
% note that we transpose them to get columns
smp001 = [event(adc001).sample]';
smp002 = [event(adc002).sample]';

factor = data_raw.fsample / data_down.fsample;

% get the sample number after downsampling
smp001 = round((smp001-1)/factor + 1);
smp002 = round((smp002-1)/factor + 1);

pre    =  round( 5*data_down.fsample);
post   =  round(20*data_down.fsample);
offset = -pre; % see ft_definetrial

trl001 = [smp001-pre smp001+post];
trl002 = [smp002-pre smp002+post];

% add the offset
trl001(:,3) = offset;
trl002(:,3) = offset;

trl001(:,4) = 1; % add a column with the condition number
trl002(:,4) = 2; % add a column with the condition number

% concatenate the two conditions and sort them
trl = sortrows([trl001; trl002]);

% remove trials that stretch beyond the end