How to halt parfor execution from a UI

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

采纳的回答

Edric Ellis
Edric Ellis 2018-5-22
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by