How to interrupt a callback while it's calling another function?

3 vues (au cours des 30 derniers jours)
Niko
Niko le 13 Jan 2015
Commenté : Niko le 14 Jan 2015
Hi All,
The callback of a GUI button in my program calls another function (which takes a long time to run). Is there a way to interrupt this callback while that other function is running? It seems like setting 'Interruptible' to 'on' only works within that callback...
Thanks,
Niko

Réponse acceptée

Image Analyst
Image Analyst le 13 Jan 2015
You can set a global variable that the routine checks periodically. See the FAQ for methods to do that: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
  1 commentaire
Niko
Niko le 14 Jan 2015
just added some pauses to the other function and it solved the problem... seems like you need to manually introduce some 'intervals' for MATLAB to process that interrupting callback. Thanks for your help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by