MATLAB: Control a GUI (push button) from a script

controlguiguidescript

I have a GUI ('GUI1') which I want to control with a script. As I am not the owner nor administrator of 'GUI' I cannot change anything in the source code, however I do have access to it.
I would like to run 'GUI1' in the background, controlling it with my script. So far I have found the object handle via "findall" using the Tag. I tried to press the push button via the callback, however, it would not execute since it had not enough input arguments. This is the error that came:
feval(@(hObject,eventdata)ETD_Datamaster('File_browse_Callback',hObject,eventdata,guidata(hObject)))
Error using @(hObject,eventdata)GUI1('File_browse_Callback',hObject,eventdata,guidata(hObject))
Not enough input arguments.
What are the possibilities for controlling a GUI from a script? Has anyone done this before

Best Answer

You are passing a function handle to feval, and the function handle requires two arguments, but you are not providing any arguments.
file_browse_button_handle = findall('Tag', 'File_browse');
cb = get(file_browse_button_handle, 'Callback');
%now invoke the callback. hObject will be the button's own handle
cb(file_browse_button_handle, []); %uicontrol pushbutton have empty event