Clear Filters
Clear Filters

How to halt parfor execution from a UI

1 view (last 30 days)
Hi all,
I'm writing a program intended to be used by others via a UI. The operation that this program performs is parallelized (using parfor) and takes a long time to complete. I'd like to have a way for the user to halt the process from a UI window while it is running. I use parfor_progressbar, a wait bar for parallelized programs, and ideally the user would be able to halt the program by closing or pressing cancel on the progress bar. Does anyone have experience with this or any ideas?
Thanks,
Alex

Accepted Answer

Edric Ellis
Edric Ellis on 22 May 2018
You might find it simpler to restructure your code to use parfeval rather than parfor. There's an example in the documentation here: https://www.mathworks.com/help/distcomp/examples/parfeval-blackjack.html that does pretty much exactly what you're after.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!