1

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!

Echo
  • 667
  • 3
  • 8
  • 19
  • 1
    I guess you'd have to check the flag in every sub-function / every loop-iteration... This one is similar (and the ones linked in the comments): https://stackoverflow.com/questions/6472731/pausing-matlab-script-or-function-on-certain-user-event – tim May 23 '16 at 17:50
  • You can find some relevant information in my answer [here](http://stackoverflow.com/a/37263669/5540279) – nirvana-msu May 23 '16 at 21:11

0 Answers0