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_nervus_header.m
    path of file: ./repos/PsPM/src/Import/fieldtrip/fileio/private
    
    the code of the file until where you have to start completion: function output = read_nervus_header(filename)
% read_nervus_header  Returns header information from Nicolet file.
%
%   FILENAME is the file name of a file in the Natus/Nicolet/Nervus(TM)
%   format (originally designed by Taugagreining HF in Iceland)
%
%   Based on ieeg-portal/Nicolet-Reader
%   at https://github.com/ieeg-portal/Nicolet-Reader
%
% Copyright (C) 2016, Jan Brogger and Joost Wagenaar 
%
% This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%  
    
function channelInfo = read_nervus_header_ChannelInfo(h, StaticPackets, Index, ITEMNAMESIZE, LABELSIZE)
%% Get CHANNELINFO (CHANNELGUID)
CH_struct = struct();
sensorIdx = StaticPackets(find(strcmp({StaticPackets.IDStr},'CHANNELGUID'),1)).index;
indexInstance = Index(find([Index.sectionIdx]==sensorIdx,1));
fseek(h, indexInstance.offset,'bof');
CH_struct.guid = fread(h, 16, 'uint8');
CH_struct.name = fread(h, ITEMNAMESIZE, '*char');
fseek(h, 152, 'cof');
CH_struct.reserved = fread(h, 16, 'uint8');
CH_struct.deviceID = fread(h, 16, 'uint8');
fseek(h, 488, 'cof');

nrIdx = fread(h,2, 'uint32');  %783
channelInfo = struct();
for i = 1: nrIdx(2)
    channelInfo(i).sensor = deblank(cast(fread(h, LABELSIZE, 'uint16'),'char')');
    channelInfo(i).samplingRate = fread(h,1,'double');
    channelInfo(i).bOn = logical(fread(h, 1 ,'uint32'));
    channelInfo(i).lInputID = fread(h, 1 ,'uint32');
    channelInfo(i).lInputSettingID = fread(h,1,'uint32');
    channelInfo(i).reserved = fread(h,4,'char');
    fseek(h, 128, 'cof');
end