how to make timer callback function?

3 visualizaciones (últimos 30 días)
Jae-Hee Park
Jae-Hee Park el 24 de Jun. de 2022
Respondida: Jan el 24 de Jun. de 2022
Hi
I tried making a timer callback function on app designer like this, but it didn't work. What is the problem?
function Test(obj,event,app,variable)
disp(variable);
disp(app.something);
end
tt = timer('Name','Test','Period',1,'ExecutionMode','fixedSpacing','BusyMode','drop');
tt.TimerFcn = {@app.Test,app,10};
start(tt);
  1 comentario
Kevin Holly
Kevin Holly el 24 de Jun. de 2022
Where is your function located?
Try removing the app. before Test?
tt.TimerFcn = {@Test,app,10};

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 24 de Jun. de 2022
app.something = 'hello';
tt = timer('Name','Test','Period',1, ...
'ExecutionMode','fixedSpacing','BusyMode','drop');
tt.TimerFcn = {@Test, app, 10}; % 1st two inputs inserted automatically
start(tt);
function Test(obj, event, app, variable)
disp(variable);
disp(app.something);
end

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by