Matlab freezes. I am using mac Apple M2 Max. OSX sonoma

80 次查看(过去 30 天)
plot(1:10,1:10) does plot a line but when I try to close it directly on the screen matlab freezes. This also happens when there are more than one fgures on the window. Lets say, there are two figures, if I try to close figure 2 first than matlab freezes but if I close the figures in order like figure 1 first then figure 2, matlab seems works fine.
I am using mac Apple M2 Max. OSX sonoma
  4 个评论
geofo
geofo 2023-12-5
According to my experience, the figure order is not relevant, but it is as follows: if the Matlab figure is partially covered by another figure (or covered by any other window, not necessarily a Matlab figure), then it is possible to close the figure placed in the background (which is partially covered) without problems. If you have two Matlab figures and try to close the figure in the foreground, (which is fully visible, not partially covered), then Matlab freezes.
Tim Lueth
Tim Lueth 2024-7-10
This bug exist also with Matlab 2024a and not only on ARM (AppleSilicon) but also on Intel Macs. It is extremely annoying, and occurs sporadically, one day there are no problems the next day every closing of the window leads to problems (killing matlab process and restart it). There is another discusson here on matlab central in which the following solution was offered to be added into the startup function.
set(groot, 'defaultFigureCloseRequestFcn', 'close(gcf)');
warning off MATLAB:Figure:RecursionOnClose;
Unfortunately, this does NOT always work. The faster the computer is, the bigger the problems become, independent on the JAVA version Oracle/Corretto8/Corretto11
For this reason i've inserted a small delay using an absolute time period
set(groot, 'defaultFigureCloseRequestFcn', 'pause(0.05); close(gcf)');
warning off MATLAB:Figure:RecursionOnClose;
The pause command ith a very small delay, helps often in combination with the graphics interface of Matlab on OSX. At least on my MACs (5) the pause solved the problem.

请先登录,再进行评论。

采纳的回答

the cyclist
the cyclist 2023-10-29
This is a known bug with R2023b (and also older releases) on Sonoma, officially acknowledged by the MathWorks Support Team. See this question/answer for lots of folks discussing it.
Regarding Walter's question, you are probably not using the "New Desktop", because the specific figure-closing bug does not occur there.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by