startbtn_CallbackThe startbtn_Callback function calls the start method of the timer object if the
timer is not already running.if strcmp(get(handles.timer, 'Running'), 'off')
start(handles.timer);
endstopbtn_CallbackThe stopbtn_Callback function calls the stop method of the timer object if the timer
is currently running.if strcmp(get(handles.timer, 'Running'), 'on')
stop(handles.timer);
endfigure1_CloseRequestFcnThe figure1_CloseRequestFcn callback executes when the user closes the app. The
function stops the timer object if it is running, deletes the timer object, and then
deletes the figure window.if strcmp(get(handles.timer, 'Running'), 'on')
stop(handles.timer);
end
% Destroy timer
delete(handles.timer)
% Destroy figure
delete(hObject);See Also
Related Examples
- “Timer Callback Functions”
- “Write Callbacks in GUIDE” on page 7-2
8 Examples of GUIDE UIs