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 Comment

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

Sign in to comment.

Answers (1)

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

5 Comments

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?

Sign in to comment.

Categories

Tags

Asked:

CF
on 27 Apr 2012

Community Treasure Hunt

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

Start Hunting!