Abort external code process called by Matlab
3 views (last 30 days)
I have a c# function called by matlab, which takes long time to process. Also, I need the ability to raise a c# flag (used for aborting the process) from a UI .
So I need to do something like the follow:
% on main file:
% launching the ui with the abort button
% calling the long c# function
% on the guide .m file:
The problem is, the "abort" button callback is executed only after the long function finished - which mean I can't abort the process.
what can i do to solve this problem? should i consider another method?
Andrew Janke on 31 Jan 2020
There's no general mechanism for aborting a C# function call. The C# function has to be written specifically to support aborting, and you'll need to call it on a separate worker thread to allow your main thread to do the timeout and then call the abort.