I want to print a secetence with different color in the command windows using 'cprintf':
https://www.mathworks.com/matlabcentral/fileexchange/24093-cprintf-display-formatted-colored-text-in-the-command-window
below are the test code:
q = parallel.pool.DataQueue; afterEach(q, @(args) cprintf(args{:})); parfor i=1:1:100 tic pause(0.5) time1=toc; fprintf(', Reading time:'); send(q,{'Keywords','%4.1f',time1}); fprintf(' seconds,') end
the code runs OK using regular for-loop, but once I changed it into parfor, the printed result are chaos, this may be caused by the combination of fprintf-cprintf-fprintf.
is there anyway to solve this problem?
Thanks!
Yu
Best Answer