MATLAB crashes on macOS Sonoma when clearing a figure.
I am repeatedly plotting on the same figure object (so that a long-running code doesn’t continuously steal focus for each new figure) and using clf(fig) to clear the figure each time. However, this consistently causes MATLAB to crash on my Mac.
I’ve seen many forum posts on this type of behavior when the figure closes, but nothing on clf specifically. I tried a few solutions:
Adding a line to my startup.m file (https://www.mathworks.com/matlabcentral/answers/2039461-matlab-freezes-i-am-using-mac-apple-m2-max-osx-sonoma, https://www.mathworks.com/matlabcentral/answers/1808195-matlab-r2022a-freezes-on-macos-monterey-12-5-1-when-closing-a-figure#answer_1324680)
Changing clf(fig) to delete(fig) or reset(fig)
Adding pause(0.1) or pause(1) before the clf (this resulted in a crash after ~20 and ~30 figures, respectively, instead of just 1 without it).
I set figure visibility to ‘off’. This tentatively seems to allow me to plot without crashing, but obviously with the limitation of not being able to see the plots as they’re generated! For some plots this is ok for me, for others it is not, such as when I’m plotting movies and want to verify that they’re accurate before wasting time plotting each frame.
I am on an M1 Mac 16GB RAM running MacOS Sonoma 14.5. Is there anything to be done so I can view my figures while plotting them?I am repeatedly plotting on the same figure object (so that a long-running code doesn’t continuously steal focus for each new figure) and using clf(fig) to clear the figure each time. However, this consistently causes MATLAB to crash on my Mac.
I’ve seen many forum posts on this type of behavior when the figure closes, but nothing on clf specifically. I tried a few solutions:
Adding a line to my startup.m file (https://www.mathworks.com/matlabcentral/answers/2039461-matlab-freezes-i-am-using-mac-apple-m2-max-osx-sonoma, https://www.mathworks.com/matlabcentral/answers/1808195-matlab-r2022a-freezes-on-macos-monterey-12-5-1-when-closing-a-figure#answer_1324680)
Changing clf(fig) to delete(fig) or reset(fig)
Adding pause(0.1) or pause(1) before the clf (this resulted in a crash after ~20 and ~30 figures, respectively, instead of just 1 without it).
I set figure visibility to ‘off’. This tentatively seems to allow me to plot without crashing, but obviously with the limitation of not being able to see the plots as they’re generated! For some plots this is ok for me, for others it is not, such as when I’m plotting movies and want to verify that they’re accurate before wasting time plotting each frame.
I am on an M1 Mac 16GB RAM running MacOS Sonoma 14.5. Is there anything to be done so I can view my figures while plotting them? I am repeatedly plotting on the same figure object (so that a long-running code doesn’t continuously steal focus for each new figure) and using clf(fig) to clear the figure each time. However, this consistently causes MATLAB to crash on my Mac.
I’ve seen many forum posts on this type of behavior when the figure closes, but nothing on clf specifically. I tried a few solutions:
Adding a line to my startup.m file (https://www.mathworks.com/matlabcentral/answers/2039461-matlab-freezes-i-am-using-mac-apple-m2-max-osx-sonoma, https://www.mathworks.com/matlabcentral/answers/1808195-matlab-r2022a-freezes-on-macos-monterey-12-5-1-when-closing-a-figure#answer_1324680)
Changing clf(fig) to delete(fig) or reset(fig)
Adding pause(0.1) or pause(1) before the clf (this resulted in a crash after ~20 and ~30 figures, respectively, instead of just 1 without it).
I set figure visibility to ‘off’. This tentatively seems to allow me to plot without crashing, but obviously with the limitation of not being able to see the plots as they’re generated! For some plots this is ok for me, for others it is not, such as when I’m plotting movies and want to verify that they’re accurate before wasting time plotting each frame.
I am on an M1 Mac 16GB RAM running MacOS Sonoma 14.5. Is there anything to be done so I can view my figures while plotting them? mac, sonoma, plot, plotting, figure, crash MATLAB Answers — New Questions