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

1 Ansicht (letzte 30 Tage)
acosep
acosep am 16 Okt. 2015
Beantwortet: Image Analyst am 16 Okt. 2015
I'm trying to pause the timer using pushbutton. Thanks.

Antworten (1)

Image Analyst
Image Analyst am 16 Okt. 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

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by