matlab自动交易系统 时间动态显示

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
        % 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

你可能感兴趣的:(matlab自动交易系统 时间动态显示)