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: RBG2Gray.m
    path of file: ./repos/Bilibili346623/MATLAB/GUI/RGB2Gray
    
    the code of the file until where you have to start completion: function varargout = RBG2Gray(varargin)
% RBG2GRAY MATLAB code for RBG2Gray.fig
%      RBG2GRAY, by itself, creates a new RBG2GRAY or raises the existing
%      singleton*.
%
%      H = RBG2GRAY returns the handle to a new RBG2GRAY or the handle to
%      the existing singleton*.
%
%      RBG2GRAY('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in RBG2
    
function RBG2Gray_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to RBG2Gray (see VARARGIN)

% Choose default command line output for RBG2Gray
handles.output = hObject;
handles.imgfilename=[];
handles.imgdata=[];
handles.imgoutput=[];
% Update handles structure
guidata(hObject, handles);

% UIWAIT makes RBG2Gray wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = RBG2Gray_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[imgfilename imgpathname]=uigetfile({'*.jpg;*.png'},'Select a RGB image');
if imgfilename
    imgdata=imread([imgpathname '\' imgfilename]);
    image(handles.axes1,imgdata);
    handles.imgfilename=imgfilename;
    handles.imgdata=imgdata;    
end