How to have a global variable that can be accessed and edited and used inside a parfor loop? Or, how to show progress of a parallel job?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mhamad Hantro
am 6 Dez. 2022
Kommentiert: Mhamad Hantro
am 6 Dez. 2022
I want to print the progress of my matlab code, and the idea is that I have a parfor loop, and I want to know which iterations are already been done, and it's very simple in concept, yet I can't find a way to implement it in MATLAB. What do you suggest?
Akzeptierte Antwort
Raymond Norris
am 6 Dez. 2022
Workers in a parfor-loop can't communicate with each other, so a global variable won't work. Consider using a DataQueue. The provides a way for the workers to send information back to the client, which can aggregate results (e.g., how many iteration have been completed). In fact, the example towards the bottom show how to display the status in a waitbar.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Parallel for-Loops (parfor) finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!