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: read_ctf_meg4.m
    path of file: ./repos/fecgsyn/subfunctions/data-generation/libs/fieldtrip/fileio/private
    
    the code of the file until where you have to start completion: function [meg] = read_ctf_meg4(fname, hdr, begsample, endsample, chanindx)


    
function [meg] = read_ctf_meg4(fname, hdr, begsample, endsample, chanindx)

% READ_CTF_MEG4 reads specified samples from a CTF continuous datafile
% It neglects all trial boundaries as if the data was acquired in
% non-continuous mode.
%
% Use as
%   [meg] = read_ctf_meg4(filename, hdr, begsample, end