Hi, I want to use a GUI pushbutton to signal an event to a running function - in particular, to issue the 'keyboard' command in a misfit function which is being called by fminsearch (to investigate the state of the fitting process). Currently I use the following: Before calling fminsearch, main script opens a small GUI with a pushbutton with callback:
function pushbutton1_Callback(hObject, eventdata, handles)
...and in the misfit function:
if interrupt, keyboard, interrupt=false; end
This works, but I have to hammer the pushbutton repeatedly to get a response (waiting after one push doesn't seem to work). There is already a drawnow command in the misfit function on each call, which apparently should allow Matlab to process outstanding events, but this does not seem to improve matters (neither does a pause(0.01)).
Can someone suggest a good way to do this which might be more responsive?