Effacer les filtres
Effacer les filtres

Close request taking a long time

10 vues (au cours des 30 derniers jours)
Andrew Landau
Andrew Landau le 2 Août 2021
Commenté : John Mikhail le 3 Août 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 commentaire
John Mikhail
John Mikhail le 3 Août 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

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur App Building dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by