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 comentario

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

Iniciar sesión para comentar.

Respuestas (1)

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

5 comentarios

CF
CF el 27 de Abr. de 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 el 27 de Abr. de 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?
Jan
Jan el 27 de Abr. de 2012
Use: start(t1)
Did you read "doc timer" already?
CF
CF el 27 de Abr. de 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?

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

CF
el 27 de Abr. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by