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: saveabaqus.m
    path of file: ./repos/fecgsyn/subfunctions/data-generation/libs/iso2mesh
    
    the code of the file until where you have to start completion: function saveabaqus(node,face,elem,fname,heading)
%
% saveabaqus(node,fname)
% saveabaqus(node,face,fname)
% saveabaqus(node,face,elem,fname)
%
% save a tetrahedral and/or surface mesh as an ABAQUS input file
%
% author: Qianqian Fang, <q.fang at neu.edu>
% date: 2012/07/05
%
% input:
%      node: input, surface node list, dimension (nn,3)
%      face: input, surface face element list, dimension (be,3)
%      elem: input, tetrahedral element list, dimension (ne,4)
%      fname: output file name

    
function saveabaqus(node,face,elem,fname,heading)
%
% saveabaqus(node,fname)
% saveabaqus(node,face,fname)
% saveabaqus(node,face,elem,fname)
%
% save a tetrahedral and/or surface mesh as an ABAQUS input file
%
% author: Qianqian Fang, <q.fang at neu.edu>
% date: 2012/07/05
%
% input:
%      node: input, surface node list, dimension (nn,3)
%      face: input, surface face element list, dimension (be,3)
%      elem: input, tetrahedral element list, dimension (ne,4)
%      fname: output file name
%      heading: optional, a descriptive string for the mesh
%
% -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
%

if(nargin==2)
   fname=face;
   face=[];
   elem=[];
end

if(nargin==3)
   fname=elem;
   elem=[];
end

fid=fopen(fname,'wt');
if(fid==-1)
    error('You do not have permission to save mesh files.');
end