In this case, your code is hitting a 60,000 character limit per output. This particular limit is part of the Live Editor, and unfortunately, there is no way to change it. Our development team will take this as feedback, and we hope to address it in a future release.
That being said, there might be some ways you can work around this limit. Although I’m not sure they’ll meet your needs, as the first two don’t work with parfor.
Workaround 1:
The Live Editor automatically groups textual output from the same line into a single output. That means that if we introduce some other output on a different line, we can have multiple outputs, each with their own 60,000 character limit. Here is a crude example that demonstrates this. The output doesn’t look so nice, but you can see all the progress.
for ind=1:10000
if (mod(ind, 1000) == 0)
disp('--')
end
disp(['Sample ', int2str(ind), ' has been processed'])
end
Workaround 2:
for ind=1:20
pause(.1)
printStatus(ind)
end
function printStatus (ind)
if ind == 1
fprintf('Last processed sample: %5d', ind);
else
fprintf('\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bLast processed sample: %5d', ind);
end
end
Workaround 3:
Since the textual output for the entire parfor is treated as one output and hence subject to the 60,000 character limit, you could potentially split up your work into a few parfors on separate lines:
parfor ind=1:1000
doStuff(ind);
end
parfor ind=1001:2000
doStuff(ind);
end
function doStuff(ind)
disp(['Sample ', int2str(ind), ' has been processed'])
end
Not a great solution, but sharing just in case.
I hope this helps, and as I said earlier, we hope to address this in a future release.
Best Answer