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: mdm_mat2nii.m
    path of file: ./repos/md-dmri/mdm
    
    the code of the file until where you have to start completion: function mdm_mat2nii(I, path, sdim)
% function mdm_mat2nii(I, path, sdim)

    
function mdm_mat2nii(I, path, sdim)
% function mdm_mat2nii(I, path, sdim)
%
% Makes nifti from I using path and header h

if ndims(I) == 2
    I = permute(I,[4 3 1 2]);
elseif ndims(I) == 3
    I = permute(I,[4 1 2 3]);
end