Dongyan - the solution will differ depending upon how you have created your GUI (GUIDE, programmatically, or App Designer) but the general idea will be the same. Your GUI will need a timer that exists for the lifetime of the GUI (so the timer cannot be a local variable within some function or method). At some point (pushbutton callback for example), you will initialize a timer with a period (one second), number of tasks to execute (10), and a callback function (that will fire as per your one second period). See Create object to schedule execution of MATLAB commands for details. If your GUI is built with GUIDE, then the following code could be put in whichever function callback that needs to start the timer
handles.timer = timer('Name','MyTimer', ...
Note how we assign the timer to the handles structure and then call guidata to save that change. Also note how we pass in to the callback the handle to the figure. We do this so that the timer callback can access the GUI to either update the countdown text or to close the GUI. This code may look like
function  = timerCallback(hTimer,~,guiHandle)
handles = guihandles(guiHandle);
tasksExecuted = get(hTimer, 'TasksExecuted');
tasksToExecute = get(hTimer, 'TasksToExecute');
if tasksExecuted == tasksToExecute
The above is untested so there might be some gotchas especially around closing the GUI.