how to use timer function to display a button after a 5sec?

i have already view from the matlab central but i don't get the mean to use timer. anyone help?
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
t = timer('TimerFcn',@(x,y)pushbutton2, 'Period', 5.0);<---------------prob
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
display ();
is it the the way to use on it?
[EDITED, code formatted, Jan S]

댓글 수: 1

http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2012년 4월 27일

0 개 추천

See "help timer" and "doc timer".
Please explain the occuring problem with any details. "prob" does not reveal, what you want to achieve.

댓글 수: 5

t = timer('TimerFcn',@(x,y)pushbutton2, 'Period', 5.0);
when i write this code in gui, it doesn't occur error but it also didn't work.
i have read from the help timer, but i don't understand. Sorry that, i'm not good in coding.
as i know it got few type which is set timer or display timer but i don't which one i need to use on it. So now i set the pushbutton2 in the visible 'Off' for initially,so i want is When press the pushbutton1 the timer will count for 5sec then the pushbutton2 will appear.
Have you started the timer?
no. i didn't set the started time. cause i don't the flow to create timer.As i know the started time
t1=timer('TimerFcn','disp(''it is 10 o''''clock'')');
startat(t1,'10:00:00');
it is this one u means?
Use: start(t1)
Did you read "doc timer" already?
yes. i read and i found that is if i need execute the timer i have to set the timer as below
T = timer('PropertyName1', PropertyValue1,
then base on what propertyvalue i want to add it is?
so as my case i have to add ObjectVisibility ,Period, ExecutionMode, StartFcn, StopFcn and TimerFcn right?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

질문:

CF
2012년 4월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by