
585Graphics and GUI
that will execute asynchronously, enabling the synchronous callback to complete its work
sooner. This will ensure better GUI responsiveness, without affecting the program logic.
Here is a simple example (we may wish to specify some more timer properties — the snip-
pet below is only for illustration):
% Regular callback function - takes a long time to complete
function myCallbackFcn(varagin)
% Call the utility function directly (synchronously)
utilityFcn();
end
% A better callback - completes much faster, using asynchronous timer
function myCallbackFcn(varagin)
% Start an asynchronous timer to perform the lengthy ...