フィルターのクリア

Close request taking a long time

10 ビュー (過去 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 Center および File ExchangeApp Building についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by