Borrar filtros
Borrar filtros

Close request taking a long time

10 visualizaciones (últimos 30 días)
Andrew Landau
Andrew Landau el 2 de Ag. de 2021
Comentada: John Mikhail el 3 de Ag. de 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 comentario
John Mikhail
John Mikhail el 3 de Ag. de 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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre App Building en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by