Livescript often fails to plot

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

What version of MATLAB are you using? I have encountered this occassionally in the past, but nowhere near as frequently as you.
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.
2024b update one
Can you provide any more details about when this happens? For me, it seemed to happen after my computer had gone to sleep.
If there's anything in common, it's that this issue tends to occur more frequently when I repeatedly run a set of plot commands, and especially if there's an error in the code causing an interruption. However, it can still happen even without any code errors. Sometimes, I just modify the data to be plotted, rerun it, and it freezes. This happens even with a freshly opened MATLAB.
Also, I don’t think it’s related to my computer configuration, as it has a 13th-gen i9 processor and 64GB of RAM.
Thanks.
Clear All Output does help a lot. About 70% of the issues can be solved with this, : )
Yep, I'm also seeing this. Clear All Output helps sometimes. PC hasn't gone to sleep.
Paul
Paul on 29 Nov 2024
Edited: Paul on 29 Nov 2024
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.
I have the same issues. Wondering if better to export plots? Has anyone tried this?
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
Does anyone have a good solution?
Having the same issue. It makes livescript very difficult to use.
@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
"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.
Saving the .mlx file and then closing it out of the editor and then reopening it seems to be helpful (R2024a)
@hong, I would additionally try "Clear all output" via the context menu of the output area of the Live Editor.
"Clear all output" never works for me in the sense that the next execution still has messed up graphics.
I don't want to annoy people by asking about New Desktop, but see if this issue is gone there. ;)
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?
Harald
Harald on 4 Mar 2025
Edited: Harald on 4 Mar 2025
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:

Sign in to comment.

Answers (1)

Harald
Harald on 10 Nov 2024
Moved: Cris LaPierre on 11 Nov 2024
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

Products

Release

R2024b

Asked:

on 8 Nov 2024

Edited:

on 4 Mar 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!