How to implement uiresume to the other function? Using GUI.

3 views (last 30 days)
I'm trying to pause the timer using pushbutton. Thanks.

Answers (1)

Image Analyst
Image Analyst on 16 Oct 2015
I don't know if you can pause it, but you can certainly stop it and then restart it later. See this snippet:
%--------------------------------------------------------------------------------------------------------------------------
function StopTimer(handles)
try
fprintf('Entering StopTimer...\n');
listOfTimers = timerfindall % List all timers, just for info.
% Get handle to the one timer that we should have.
if isempty(listOfTimers)
% Exit if there is no timer to turn off.
fprintf('There are no timers to turn off. Leaving StopTimer().\n');
return;
end
handleToTimer = getappdata(handles.figMainWindow, 'timerObj');
% Stop that timer.
stop(handleToTimer);
% Delete all timers from memory.
listOfTimers = timerfindall
if ~isempty(listOfTimers)
delete(listOfTimers(:));
end
fprintf('Left StopTimer and turned off all timers.\n');
catch ME
errorMessage = sprintf('Error in StopTimer().\nThe error reported by MATLAB is:\n\n%s', ME.message);
fprintf('%s\n', errorMessage);
WarnUser(errorMessage);
end
return; % from btnStopTimer_Callback

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!