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_brainstorm_data.m
    path of file: ./repos/fieldtrip/fileio/private
    
    the code of the file until where you have to start completion: function [dat] = read_brainstorm_data(filename, hdr, begsample, endsample, chanindx)

    
function [dat] = read_brainstorm_data(filename, hdr, begsample, endsample, chanindx)

% READ_BRAINSTORM_DATA reads .EEG files that have been generated by
% the Nihon Kohden system. The function constitutes a wrapper around
% BrainStorm3 functionalities
%
% Use as
%   [dat] = read_brainstorm_data(filename, hdr, begsample, end