timeStr = strrep(datestr(now, 'mmm dd-HH:MM:SS'),'-',char(10));
GUI.hTimeLabel = uicontrol('Style','text', 'Units','norm', 'Position',[0,.8,.2,.17], 'FontSize',20, 'Background','w', 'String',timeStr);
start(timer('Tag','periodicClock', 'Period',0.5, 'ExecutionMode','FixedDelay', 'StartDelay',0.0, 'ErrorFcn','', 'TimerFcn',@periodicClockFcn));
function periodicClockFcn(hTimer,eventData) %#ok<INUSD>
% Update the timestamp label
try
newLabel = strrep(datestr(now, 'mmm dd-HH:MM:SS'),'-',char(10));
set(GUI.hTimeLabel, 'String',newLabel);
catch
stop(hTimer);
delete(hTimer);
end
end % periodicClockFcn
746

被折叠的 条评论
为什么被折叠?



