Creates a graphical progress indicator to monitor the completion of iterations in a long-running loop. The usage is similar to MATLAB's built in waitbar function, but it works with parfor loops in addition to ordinary for loops. A temporary file is written to by worker threads to record the completion of each parfor iteration and a timer periodically updates the progress bar. Through optional arguments that are passed to waitbar internally, the user can set a cancel button or any other option that waitbar supports. For now, only local execution is supported, but the function can be modified to replace tempdir with a location accessible by all workers.
N=50; %total number of parfor iterations
hbar = parfor_progressbar(N,'Please wait...'); %create the progress bar
pause(rand); % computation
hbar.iterate(1); % update progress by one iteration
close(hbar); % close the progress bar
Daniel Terry (2021). parfor_progressbar (https://www.mathworks.com/matlabcentral/fileexchange/53773-parfor_progressbar), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!