I have a function in matlab that contains a few sub functions. Currently abort processing is done by looking for a flag before every sub function, then assert
. PS: This is not in a GUI.
But some sub functions take longer processing time, maybe due to a loop, or a time consuming function in the sub function. So it takes longer to abort processing sometimes.
Is there any way I can set a thread to be constantly (or at a fixed interval) looking for the flag to abort? Or do I need to go in the sub functions, look for the flag in each loop and inside the time consuming function?
Thank you!