//below is the code for timer declaration
t_obj = timer;
t_obj.ExecutionMode = 'fixedRate';
t_obj.Period = 1; % seconds
t_obj.StartDelay = 0;
t_obj.TimerFcn = @(~,~)set(handles.timeStr,'String',regexprep(handles.timeStr.String,'^\d+','${num2str(str2double($0)+1)}'));
// code for using starting timer
function pushbuttoncallback((hObject, eventdata, handles)
handles = guidata(hObject);
start(handles.timer)
// execute code : time taken to run code is mimicked by pause function
pause(10)
stop(handles.timer);
end