Filter löschen
Filter löschen

Close request taking a long time

10 Ansichten (letzte 30 Tage)
Andrew Landau
Andrew Landau am 2 Aug. 2021
Kommentiert: John Mikhail am 3 Aug. 2021
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 Kommentar
John Mikhail
John Mikhail am 3 Aug. 2021
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

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu App Building finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by