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: figpng.m
    path of file: ./repos/gptoolbox/utility
    
    the code of the file until where you have to start completion: function f = figpng(filename,varargin)
  % FIGPNG Write the current figure to filename. If filename exists, replace it
  %
  % Inputs:
  %   filename  path to png file

    
function f = figpng(filename,varargin)
  % FIGPNG Write the current figure to filename. If filename exists, replace it
  %
  % Inputs:
  %   filename  path to png file
  % Outputs:
  %   f  flag whether file already existed
  % 
  frame = getframe(gcf);
  imwrite(frame.cdata,filename);
end