Live script fprintf temporarily not printing whole line
24 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
While doing a bunch of file IO in a Live Script, and printing with fprintf, sometimes the line does not complete printing. Temporarily, it looks like the image below until the next iteration begins.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1758839/image.png)
I was able to sort of recreate the effect with the code below, but what can be only a flicker in the execution of this snippet is much more noticable on my other project.
for i= 1:10
fprintf("Hello %d\n",i)
B= inv(rand(3000)+ 2*eye(3000));
end
Is this a bug or am I missing something?
2 Commenti
Walter Roberson
il 23 Ago 2024 alle 19:38
This does not surprise me.
Output within Live Script is buffered. There are weird effects. For example
hold on
for i = 1 : 10
plot(rand(1,5));
fprintf("Hello\n");
end
plot(0.5,1,'*');
will display all of the text first and the plot at the end, but
hold on
for i = 1 : 10
plot(rand(1,5));
fprintf("Hello\n");
end
will display all except one of the text first, then the plot, then the last text.
dpb
il 24 Ago 2024 alle 14:19
Never use live script so no experience, but...I don't suppose a drawnow will make any difference here? Does disp act any differently?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Get Started with MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!