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

3 次查看(过去 30 天)
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

采纳的回答

Image Analyst
Image Analyst 2015-1-13
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 个评论
Niko
Niko 2015-1-14
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!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by