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 Kommentar

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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jan
Jan am 27 Apr. 2012

0 Stimmen

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

5 Kommentare

CF
CF am 27 Apr. 2012
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?
CF
CF am 27 Apr. 2012
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?
CF
CF am 27 Apr. 2012
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?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

CF
am 27 Apr. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by