Plotting suddenly not coming up

57 views (last 30 days)
June Yang
June Yang on 12 Jul 2017
Answered: Patrick on 1 Nov 2022
Hi Everyone,
So sometimes Matlab will stop popping out figures even when I'm running the exact code that used to make beautiful plots a moment ago. It happens a lot to me and my solution has always just been to restart Matlab, in which then the code will work normally. I always assumed that it is probably because I messed up something or created some object while I was messing with other editors in the workspace, but does any one know why exactly? Also, how do you fix this problem other than just restarting the workspace?

Answers (2)

James Tursa
James Tursa on 12 Jul 2017
Edited: James Tursa on 12 Jul 2017
This is just a guess, but perhaps you are running a script which populates the current workspace with variables, and those variables are interfering with a "clean" re-running of the script. E.g., maybe you inadvertently created a variable named "plot" in your script, and that is interfering with calling the actual plot function when you re-run the script. Things like this can cause the same code to behave differently because the code inadvertently uses some of those pre-existing variables. You could scrub your code to look for stuff like this, or maybe convert your code into a function to force it to start with a clean workspace every time it runs.
To get a more detailed response to your question you would have to post your code for us to look at.

Patrick
Patrick on 1 Nov 2022
I had the same issue. I went through my live script and simply broke it into more sections so that no section was exceptionally long. It works now. Note that I did restart MatLab a couple time during the troubleshooting too but what made the difference in the end was creating more section breaks.
Good luck!

Categories

Find more on MATLAB 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!