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: save_untouch_header_only.m
    path of file: ./repos/malini/NIFTI
    
    the code of the file until where you have to start completion: %  This function is only used to save
    
function write_hdr(hdr, fileprefix)

   fid = fopen(sprintf('%s.hdr',fileprefix),'w');

   if isfield(hdr.hist,'magic')
      save_untouch_nii_hdr(hdr, fid);
   else
      save_untouch0_nii_hdr(hdr, fid);
   end