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: rejectvisual_trial.m
    path of file: ./repos/spm12/external/fieldtrip/private
    
    the code of the file until where you have to start completion: function [chansel, trlsel, cfg] = rejectvisual_trial(cfg, data)

% SUBFUNCTION for ft_rejectvisual

% determine the initial selection of trials
ntrl   = numel(data.trial);
trlsel = true(1, ntrl);

% determine the initial selection of channels

    
function [chansel, trlsel, cfg] = rejectvisual_trial(cfg, data)

% SUBFUNCTION for ft_rejectvisual

% determine the initial selection of trials
ntrl   = numel(data.trial);
trlsel = true(1, ntrl);

% determine the initial selection of channels
nchan   = numel(data.label);
chansel = true(1, nchan);

% compute the sampling frequency from the first two timepoints
fsample = 1/mean(diff(data.time{1}));

% compute the offset from the time axes
offset = zeros(ntrl,1);
for i=1:ntrl
  offset(i) = time2offset(data.time{i}, fsample);
end