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_double_matrix.m
    path of file: ./repos/spm/external/mne
    
    the code of the file until where you have to start completion: function fiff_write_double_matrix(fid,kind,mat)
%
% fiff_write_double_matrix(fid,kind,mat)
% 
% Writes a double-precision floating-point matrix tag
%
%     fid           An open fif file descriptor
%     kind          The tag kind
%     mat           The data matrix
%

%

    
function fiff_write_double_matrix(fid,kind,mat)
%
% fiff_write_double_matrix(fid,kind,mat)
% 
% Writes a double-precision floating-point matrix tag
%
%     fid           An open fif file descriptor
%     kind          The tag kind
%     mat           The data matrix
%

%
%
%   Author : Matti Hamalainen, MGH Martinos Center
%   License : BSD 3-clause
%
%   Revision 1.1  2006/09/23 14:43:56  msh
%   Added routines for writing complex and double complex matrices.
%   Added routine for writing double-precision real matrix.
%
%

me='MNE:fiff_write_double_matrix';

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

ndim = ndims(mat);
if ndim < 2 || ndim > 3
   error(me,'Input should be a two-dimensional or three-dimensional matrix');
end