MATLAB: Create a function to press button (instead of a function calling the callback function of the button)

button presscallback

Hi,
First of all sorry for the previous post that contains exactly this message. I did not pay attention and wrote it in the wrong section.
I made a GUI containing several buttons, each of them calling a specific callback with a bunch of arguments. For example, a button named 'my button' using two arguments arg1 and arg2 is created that way:
Positionmybutton=[0.1 0.1 0.1 0.1];
uicontrol(fh_gui,...
'units', 'normalized','Position',Positionmybutton,...
'String','my button',...
'Callback',{@button_callback,arg1,arg2});
I can very easily find the object 'my button' since I know its position in the figure (use of findobj).
Remind now that I have several buttons (e.g. button1, button2, button3), each using a various number of arguments. My aim is to create a general push button 'general_button' which will act as if the user presses on multiple buttons (e.g. pressing on general_button = pressing on button2 and button3). However, I do not know how to deal with the button handles so that I do not have to pass every arguments that button2 and button3 would need as argument of the callback for general_button. I hope the following example will explain the problem itself.
Lets imagine that the the buttons are created that way:
uicontrol(fh_gui,...
'Position',Positionbutton2,...
'String','button2',...
'Callback',{@button_callback, arg1_but2, arg2_but2});
uicontrol(fh_gui,...
'Position',Positionbutton3,...
'String','button3',...
'Callback',{@button_callback, arg1_but3, arg2_but3, arg3_but3});
The general button would be:
uicontrol(fh_gui,...
'Position',Positionbuttongeneral,...
'String','button general',...
'Callback',{@button_callback, ...
arg1_but2, arg2_but2...
arg1_but3, arg2_but3, arg3_but3});
All the arguments of button2 and 3 are passed so that the callback of each button can be called with the correct arguments. Do they exist in the handle so that I simply have to pass the handles (one per button) instead of all the arguments ? Or more simply, is there a way to 'push' a button without the user pressing on it?
Thank you very much for your answers, Gaelle

Best Answer

Hi,
Thank you for your answer. I mainly needed the trick to get the callback name and arguments of a button, using
cb = get(handles.button, 'Callback');
Now I would like to call the callback specified in the handles, for example:
cb{1} = @gui_clusterGC2/tbutton_ISILFD
using the arguments in cb{2:end}. Is there a quick way to do this? -> I guess I can simply do:
cb{1}([],[],cb{2:end})
This works :)
Thank you!