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: append_pdfs.m
    path of file: ./repos/gift/GroupICAT/icatb/toolbox/export_fig
    
    the code of the file until where you have to start completion: function append_pdfs(varargin)
%APPEND_PDFS Appends/concatenates multiple PDF files
%
% Example:
%   append_pdfs(outputFilename, inputFilename1, inputFilename2, ...)
%   append_pdfs(outputFilename, inputFilenames_list{:})
%   append_pdfs(outputFilename, inputFilenames_cell_or_string_array)
%   append_pdfs output.pdf input1.pdf input2.pdf
%
% This function appends multiple PDF files to an existing PDF file,
    
function is required by append_pdf.m. Install the complete export_fig package from https://www.mathworks.com/matlabcentral/fileexchange/23629-export_fig or https://github.com/altmany/export_fig')
    end

    % Are we appending or creating a new file
    append = exist(varargin{1}, 'file') == 2;
    output = [tempname '.pdf'];
    try
        % Ensure that the temp dir is writable (Javier Paredes 26/2/15)
        fid = fopen(output,'w');
        fwrite(fid,1);
        fclose(fid);
        delete(output);
        isTempDirOk = true;
    catch
        % Temp dir is not writable, so use the output folder
        [dummy,fname,fext] = fileparts(output); %#ok<ASGLU>
        fpath = fileparts(varargin{1});
        output = fullfile(fpath,[fname fext]);
        isTempDirOk = false;
    end