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: mz3_read.m
    path of file: ./repos/gift/GroupICAT/icatb/@gifti/private
    
    the code of the file until where you have to start completion: function M = mz3_read(filename)
% Read MZ3-formatted data from disk
% FORMAT M = mz3_read(filename)
%
% filename - MZ3-formatted file name
% M        - data structure
%__________________________________________________________________________
% 
% MZ3 Format Specification:
% https://github.com/neurolabusc/surf-ice/tree/master/mz3
%__________________________________________________________________________

    
function M = mz3_read(filename)
% Read MZ3-formatted data from disk
% FORMAT M = mz3_read(filename)
%
% filename - MZ3-formatted file name
% M        - data structure
%__________________________________________________________________________
% 
% MZ3 Format Specification:
% https://github.com/neurolabusc/surf-ice/tree/master/mz3
%__________________________________________________________________________
% Copyright (C) 2018 Wellcome Trust Centre for Neuroimaging

% Guillaume Flandin
% $Id: mz3_read.m 7400 2018-08-17 13:53:33Z guillaume $


M = struct();

%-Open file
%--------------------------------------------------------------------------
fid = fopen(filename,'r','ieee-le');
if fid == -1
    error('Cannot open %s.',filename);
end