フィルターのクリア

Matlab Online Figures Won't Close

3 ビュー (過去 30 日間)
Dieter
Dieter 2024 年 5 月 14 日
回答済み: Image Analyst 2024 年 5 月 14 日
I have a Simulink / Matlab program that runs scrips and generates many figures. They are generated in a script and then closed in the same script. When I run it on the computer the figures close. When I run it online however, the figure contents close but there is a blank figure left that will not close at all. I have to exit Matlab Online and open a new session to ever get rid of them.
How do I properly get Matlab figures to close online?
figure(101);
hold on;
plot(BASEQ.Time,BASEQ.LSAngularWorkonArm);
plot(BASEQ.Time,BASEQ.RSAngularWorkonArm);
plot(BASEQ.Time,BASEQ.LEAngularWorkonForearm);
plot(BASEQ.Time,BASEQ.REAngularWorkonForearm);
plot(BASEQ.Time,BASEQ.LWAngularWorkonClub);
plot(BASEQ.Time,BASEQ.RWAngularWorkonClub);
ylabel('Work (J)');
grid 'on';
%Add Legend to Plot
legend('LS Angular Work','RS Angular Work','LE Angular Work','RE Angular Work','LW Angular Work','RW Angular Work');
legend('Location','southeast');
%Add a Title
title('Angular Work on Distal Segment');
subtitle('BASE');
%Save Figure
savefig('BaseData Charts/BASE_Plot - Angular Work');
%Close Figure
close(101);
  2 件のコメント
Rik
Rik 2024 年 5 月 14 日
Can you try using explicit handles for all your graphics calls?
Dieter
Dieter 2024 年 5 月 14 日
I managed to get it running by adding a 1 second pause after saving. A bit inconvenient as there is probably 150 total charts the program creates so it will add a few minutes to the process.
Would an explicit handle help prevent needing the pause?

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2024 年 5 月 14 日
Worth a try
hfig1 = figure('Name', 'Figure 1');
% Do stuff, then close it explicitly
close(hFig1);
drawnow; % Force immediate update of screen instead of waiting.

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by