MATLAB: How to execute checkbox callback by using pushbutton callback

guiguidelistboxmatlab gui

Hi,
I will be thankful if you could help me in this. I am new to matlab, i would like to click the pushbutton and in the same time it should execute the checkbox or listbox callback(similar to clicking the checkbox/listbox). How can i do this.

Best Answer

h = HandleOfOtherControl;
cb = get(h, 'Callback'); %this retrieves the callback
cb{1}(h, [], cb{2:end}); %this invokes the callback
Warning to other readers: this sequence will not work for callbacks constructed by GUIDE, as those use are strings instead of cell arrays of that contain the function handle. Fortunately Karthick KJ does not appear to be using GUIDE (or at least has not mentioned using GUIDE in any posting.)