App Designer - Code that runs whenever a callback function is executed
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I am working on an App Designer app.
I have dozens of callback functions in my app and and all of them do computations that take a long time. For now, they all look like this :
function myfunction(app, event)
set(app.UIFigure, 'pointer', 'watch')
drawnow;
%some code
set(app.UIFigure, 'pointer', 'arrow')
drawnow;
end
I would like to know if it is possible to have a code that runs whenever a callback function is executed, so that I only write these lines once.
Thanks in advance,
Gwendal
0 comentarios
Respuestas (1)
Kevin Holly
el 29 de Abr. de 2022
Editada: Kevin Holly
el 29 de Abr. de 2022
You can create a function/script MATLAB file that you can call from MATLAB. Alternatively, you can create a function within the app that can be called by multiple callbacks. You can insert a function within App Designer when it is in code view by clicking the "Function" button on the toolstrip under the Editor tab. You can send all the property variables within the app to the function's workspace by using "app" as the input.
foo(app)
1 comentario
Gwendal Marrec
el 3 de Mayo de 2022
Editada: Gwendal Marrec
el 3 de Mayo de 2022
Ver también
Categorías
Más información sobre Interactive Control and Callbacks 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!