matlabpool open local 4
parfor loop = 1:n
disp(sprintf('Processing data module #%.0f out of #%.0f', loop, n));
doDataProcessing(loop);
end
matlabpool close
I am having a problem where the messages created by disp() do not get outputted to the command window during the execution of the parfor loop. Instead, all the disp messages are outputted all at once after the parfor loop completes or if I stop execution midway. Is there a command I can use to flush out the buffered output text or force the text from the worker to the client so that the client can display it while the parfor loop is running?
Thanks
> I am writing a basic parfor loop which consists of outputting to the screen
> using disp(). The general structure of my code is as follows:
>
> matlabpool open local 4
> parfor loop = 1:n
> disp(sprintf('Processing data module #%.0f out of #%.0f', loop, n));
> doDataProcessing(loop);
> end
> matlabpool close
>
> I am having a problem where the messages created by disp() do not get
> outputted to the command window during the execution of the parfor
> loop. Instead, all the disp messages are outputted all at once after the
> parfor loop completes or if I stop execution midway.
Hi,
We enhanced the PARFOR output in R2008b to print the output progressively, so if
you can upgrade to that release (or R2009a), things should work as you expect.
Cheers,
Edric.
Hello,
It seems that the output displays only after a carriage return is displayed. I.e. fprintf('foo'); doesn't display anything until all iterations are complete. But fprintf('foo\n'); does display. Is there any way to get around that limitation?
Also, is there ANY way to display a GUI progress indicator? As far as I can tell, it is impossible to update any kind of UI object from within the parfor loop, which means the user just has to sit and wait without any visual indication of progress. Is that correct? Any way to get around this limitation?
Thanks,
Mason