Skip to content

Instantly share code, notes, and snippets.

@stefanschmidt
Last active August 29, 2015 14:23
Show Gist options
  • Save stefanschmidt/048b5b8139c609ca6437 to your computer and use it in GitHub Desktop.
Save stefanschmidt/048b5b8139c609ca6437 to your computer and use it in GitHub Desktop.
Continuous screen output in parfor loop
% to enable continuous screen output in a parfor loop place a
% pause of 2-3 seconds before each fprintf or disp statement.
% it seems this flushes the stdout buffer of the worker nodes.
% tested with a local parpool in Matlab R2014b on OS X 10.9.5.
fprintf('pre\n')
parfor n = 1:5
pause(2)
fprintf('start %i\n',n)
pause(10)
fprintf('end %i\n',n)
end
pause(2)
fprintf('post\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment