This is expected. The worker running your batch job has no access to your display, and cannot display any graphics (including a waitbar). In general, the only way to get status updates back to the client from a batch job is to have your task write "command-window" output - this can then be retrieved by calling the diary method of the job. For example:
warning off parallel:batch:DiaryIncomplete
j = batch('slowOutput');
t = tic();
while ~wait(j, 'finished', 1)
diaryText = j.Tasks.Diary;
if isempty(diaryText)
fprintf('After %g seconds, diary still empty.\n', toc(t));
continue;
end
diaryLines = strsplit(strtrim(diaryText), newline);
fprintf('After %g seconds, last line of diary is: <%s>\n', ...
toc(t), diaryLines{end});
end
which on my machine prints out the following:
After 1.08259 seconds, diary still empty.
After 2.15081 seconds, diary still empty.
After 3.229 seconds, diary still empty.
After 4.30916 seconds, diary still empty.
After 5.39267 seconds, diary still empty.
After 6.48431 seconds, diary still empty.
After 7.58172 seconds, diary still empty.
After 8.6777 seconds, diary still empty.
After 9.77717 seconds, last line of diary is: <Completed iteration: 1>
After 10.886 seconds, last line of diary is: <Completed iteration: 3>
After 11.9932 seconds, last line of diary is: <Completed iteration: 5>
After 13.0959 seconds, last line of diary is: <Completed iteration: 7>
After 14.197 seconds, last line of diary is: <Completed iteration: 9>
and slowOutput.m is
for idx = 1:10
pause(0.5);
fprintf('Completed iteration: %d\n', idx);
end
Best Answer