How to clear the error "Functionality not supported with figures created with the uifigure function." ?

Hello ,
I'm seeing the following error,
"Functionality not supported with figures created with the uifigure function."
for the below code lines
figs = findall(groot,'Type','Figure');
for i= 1:length(figs)
shh = get(0,'ShowHiddenHandles'); %finds the open figures
set(figs(i),'PaperPositionMode','auto');
set(figs(i),'InvertHardcopy','off');
saveas(figs(i),sprintf('TC%d(%d).png',j,i+1));
end
The above lines are needed to take the screenshots of the test results
Any suggesstions are highly appreciated
Thank you in advance!

回答 (1 件)

Voss
Voss 2024 年 5 月 24 日
編集済み: Voss 2024 年 5 月 24 日
I presume you want that code to iterate over all figures but not uifigures.
You could close all the uifigures before running the code, or you can modify the code to skip uifigures as follows:
figs = findall(groot,'Type','Figure');
for i= 1:length(figs)
if matlab.ui.internal.isUIFigure(figs(i))
% if it's a uifigure, skip it
continue
end
set(figs(i),'PaperPositionMode','auto');
set(figs(i),'InvertHardcopy','off');
saveas(figs(i),sprintf('TC%d(%d).png',j,i+1));
end

カテゴリ

ヘルプ センター および File ExchangeInteractive Control and Callbacks についてさらに検索

質問済み:

2024 年 5 月 24 日

編集済み:

2024 年 5 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by