Livescript often fails to plot
Show older comments
I often encounter an issue in Livescript when I rerun a block to replot. The old plot turns gray, but the new plot never appears. I tried clear all close all, but it doens't help.
The only way to fix this is restarting MATLAB, and when I try to close it, a message appears saying, "An operation is in process" preventing me from exiting normally, regardless of how long I wait. The only way to close it is by ending the task in Task Manager.
It’s particularly frustrating because this happens very often, requiring me to restart MATLAB several times a day.
Has anyone else experienced this?
19 Comments
Cris LaPierre
on 8 Nov 2024
What version of MATLAB are you using? I have encountered this occassionally in the past, but nowhere near as frequently as you.
Harald
on 8 Nov 2024
If you have not done so yet, also try right-clicking in the output area of the Live Script and selecting "Clear All Output".
I admit that this is still an inconvenience and as Cris mentions there should not be a need to do so a lot anymore, but not as much of an inconvenience as restarting MATLAB.
Ruowen
on 8 Nov 2024
Cris LaPierre
on 8 Nov 2024
Can you provide any more details about when this happens? For me, it seemed to happen after my computer had gone to sleep.
Ruowen
on 9 Nov 2024
Ruowen
on 9 Nov 2024
Jon
on 29 Nov 2024
Yep, I'm also seeing this. Clear All Output helps sometimes. PC hasn't gone to sleep.
I used to have a lot of problems with graphics in LiveScript, then things seemed to get better, but now I'm back to having problems (R2024a). I've seen this happen when the computer is wide awake and I'm basically in the standard workflow of edit->run->inspect->edit ...
I get the gray box, as described above. Sometimes, I don't even get a gray box, just blank space. Sometimes I also get into a situation where the graphics editing controls (zoom, pan, etc.) either don't show up, or show up but aren't selectable, i.e., clicking in the zoom button doesn't actually allow me to zoom. Or I get situation where a plot is very light (don't know if that means it's still the old plot from the previous run that didn't update). Here's an example that, coincidentally, I just ran into.

More annoying, is that problems in LiveScript graphics sometimes carry over into problems with graphics commands at the command prompt, like a plot command just hanging. Clear All Output usually doesn't work for me. I don't know what triggers this behavior.
But, I have noticed that when it happens I can mash on ctrl-c a couple of times from the command prompt and eventually some long error message in red shows up about which function was interrupted. IIRC, it's something like a WindowButtonDown function is interrupted. Maybe I clicked with an unexpected mouse button on a graphic in LiveScript and that causes a problem with some infinite loop or something. In some cases, the ctrl-c thing gets everything back to normal, but it in other cases it doesn't and quit is the only solution.
FWIW, the problem seems to be isolated to a particular script. I copied the code from the script that's currently giving me graphics problems to a script in a new editor tab and it runs fine.
Sambacor
on 11 Feb 2025
I have the same issues. Wondering if better to export plots? Has anyone tried this?
Harald
on 11 Feb 2025
Are you using New Desktop? If not, I'd be curious to see if that changes anything for you: https://www.mathworks.com/matlabcentral/fileexchange/119593-new-desktop-for-matlab-beta
hong
on 2 Mar 2025
Does anyone have a good solution?
Having the same issue. It makes livescript very difficult to use.
Harald
on 2 Mar 2025
@hong, also my suggestion to you: if you are not using New Desktop, please try it and let us know if that changes anything for you: https://www.mathworks.com/matlabcentral/fileexchange/119593-new-desktop-for-matlab-beta
hong
on 3 Mar 2025
"clc; clear all; close all;" seems to help a lot.
Haven't tried the new desktop. The review doesn't seem to be very positive.
Paul
on 3 Mar 2025
Saving the .mlx file and then closing it out of the editor and then reopening it seems to be helpful (R2024a)
Paul
on 3 Mar 2025
"Clear all output" never works for me in the sense that the next execution still has messed up graphics.
Harald
on 4 Mar 2025
Sorry to hear that, @Paul. Have you tried New Desktop?https://www.mathworks.com/matlabcentral/fileexchange/119593-new-desktop-for-matlab-beta
I don't want to annoy people by asking about New Desktop, but see if this issue is gone there. ;)
Paul
on 4 Mar 2025
No, I haven't. Frankly, I have no idea what you're referring to. Is there any reason to think the New Desktop would help?
From my non-developer understanding, New Desktop is an evolution of the desktop for a soonish future release that will change a lot of things. It may cause a few problems, but it is very likely to also address previously existing problems. To me, both are very good reasons to give it a try. I recall running into the situation mentioned here but have been using New Desktop for a while and have not run into it since. On the other hand, "Clear all output" used to fix things for me quite often, so we may observe similar symptoms but have different underlying problems.
New Desktop is available here:
It's an add-on that you can enable to try it out and also disable again, you will just need to restart MATLAB in between.
More information is also available here:
Answers (1)
Harald
on 10 Nov 2024
Moved: Cris LaPierre
on 11 Nov 2024
0 votes
30% of "often" is still quite often though. ;)
Are you using New Desktop? If not, I'd be curious to see if that changes anything for you: https://www.mathworks.com/matlabcentral/fileexchange/119593-new-desktop-for-matlab-beta
Unless others have any suggestions, I recommend that you contact Technical Support for the colleagues to analyze in detail and provide a solution or forward the issue to development.
Best wishes,
Harald
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!