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: fiff_write_ch_info.m
    path of file: ./repos/spm12/external/mne
    
    the code of the file until where you have to start completion: function fiff_write_ch_info(fid,ch)
%
% fiff_write_ch_info(fid,ch)
%
% Writes a channel information record to a fif file
%
%     fid           An open fif file descriptor
%     ch            The channel information structure to write
%
%     The type, cal, unit, and pos members are explained in Table 9.5
%     of the MNE manual
%

%
%
%   Author : Matti Hamalainen, MGH Martinos Center
%   License : BSD 3-clause
%
%   Revision 1.6  2006/04/23 15:29:40  msh
%   Added MGH to the copyright
%
%   Revision 1.5  2006/04/18 20:44:46  msh
%   Added reading of forward solution.
%   Use length instead of size when appropriate
%
%   Revision 1.4  2006/04/13 17:47:50  msh
%   Make coil coordinate transformation or EEG electrode location out of the channel  info.
%
%   Revision 1.3  2006/04/12 10:29:02  msh
%   Made evoked data writing compatible with the structures returned in reading.
%
%   Revision 1.2  2006/04/10 23:26:54  msh
%   Added fiff reading routines
%
%   Revision 1.1  2005/12/05 16:01:04  msh
%   Added an initial set of fiff writing routines.

    
function fiff_write_ch_info(fid,ch)
%
% fiff_write_ch_info(fid,ch)
%
% Writes a channel information record to a fif file
%
%     fid           An open fif file descriptor
%     ch            The channel information structure to write
%
%     The type, cal, unit, and pos members are explained in Table 9.5
%     of the MNE manual
%

%
%
%   Author : Matti Hamalainen, MGH Martinos Center
%   License : BSD 3-clause
%
%   Revision 1.6  2006/04/23 15:29:40  msh
%   Added MGH to the copyright
%
%   Revision 1.5  2006/04/18 20:44:46  msh
%   Added reading of forward solution.
%   Use length instead of size when appropriate
%
%   Revision 1.4  2006/04/13 17:47:50  msh
%   Make coil coordinate transformation or EEG electrode location out of the channel  info.
%
%   Revision 1.3  2006/04/12 10:29:02  msh
%   Made evoked data writing compatible with the structures returned in reading.
%
%   Revision 1.2  2006/04/10 23:26:54  msh
%   Added fiff reading routines
%
%   Revision 1.1  2005/12/05 16:01:04  msh
%   Added an initial set of fiff writing routines.
%
%

me='MNE:fiff_write_ch_info';

if nargin ~= 2
    error(me,'Incorrect number of arguments');
end

FIFF_CH_INFO=203;
FIFFT_CH_INFO_STRUCT=30;
FIFFV_NEXT_SEQ=0;

%typedef struct _fiffChPosRec {
%  fiff_int_t   coil_type;          /*!< What kind of coil. */
%  fiff_float_t r0[3];              /*!< Coil coordinate system origin */
%  fiff_float_t ex[3];              /*!< Coil coordinate system x-axis unit vector */
%  fiff_float_t ey[3];              /*!< Coil coordinate system y-axis unit vector */
%  fiff_float_t ez[3];             /*!< Coil coordinate system z-axis unit vector */
%} fiffChPosRec,*fiffChPos;        /*!< Measurement channel position and coil type */


%typedef struct _fiffChInfoRec {
%  fiff_int_t    scanNo;        /*!< Scanning order # */
%  fiff_int_t    logNo;         /*!< Logical channel # */
%  fiff_int_t    kind;          /*!< Kind of channel */
%  fiff_float_t  range;         /*!< Voltmeter range (only applies to raw data ) */
%  fiff_float_t  cal;           /*!< Calibration from volts to... */
%  fiff_ch_pos_t chpos;         /*!< Channel location */
%  fiff_int_t    unit;          /*!< Unit of measurement */
%  fiff_int_t    unit_mul;      /*!< Unit multiplier exponent */
%  fiff_char_t   ch_name[16];   /*!< Descriptive name for the channel */
%} fiffChInfoRec,*fiffChInfo;   /*!< Description of one channel */

datasize=4*13 + 4*7 + 16;
count = fwrite(fid,int32(FIFF_CH_INFO),'int32');
if count ~= 1
    error(me,'write failed');
end