Close request taking a long time

조회 수: 18 (최근 30일)
Andrew Landau
Andrew Landau 2021년 8월 2일
댓글: John Mikhail 2021년 8월 3일
Sometimes when I generate figures from the live editor it takes a very long time to close them. Frustratingly long...
For example, I have some code where I call imagesc twice to make two figures. Example code below --
figure(1); clf;
imagesc(image1);
figure(2); clf;
imagesc(image2);
I turned the profiler on, ran that section of code, then closed the two figures, and loaded profile viewer. Here's the result:
As you should be able to see, the "closereq" function took 59 seconds. What??? What's going on, how do I speed this up?
My computer is working normally and I can run most code very fast and efficiently, it's specifically figure closing that takes a long time.
Thanks for any tips!
  댓글 수: 1
John Mikhail
John Mikhail 2021년 8월 3일
Does this also happen for very simple figures? For example, if you just run
figure(1)
close all
does it also take a long time?
Also, try opening the closereq function and making sure it looks like this:
function closereq
%CLOSEREQ Figure close request function.
% CLOSEREQ deletes the current figure window. By default, CLOSEREQ is
% the CloseRequestFcn for new figures.
% Copyright 1984-2012 The MathWorks, Inc.
% Note that closereq now honors the user's ShowHiddenHandles setting
% during figure deletion. This means that deletion listeners and
% DeleteFcns will now operate in an environment which is not guaranteed
% to show hidden handles.
if isempty(gcbf)
if length(dbstack) == 1
warning(message('MATLAB:closereq:ObsoleteUsage'));
end
close('force');
else
delete(gcbf);
end

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by