필터 지우기
필터 지우기

Code to check for open uifigures

조회 수: 6 (최근 30일)
Katherine
Katherine 2023년 11월 8일
답변: Voss 2023년 11월 8일
So I have some code that creates a uifigure. When I rerun the script I want it to clear the uifigure. Obviously the code needs to distinguish if I left the ui figure open so it can clear it, or does it need to create a new one. I can't seem to find a function that will work to check for the uifigure, does anyone know the answer?

답변 (1개)

Voss
Voss 2023년 11월 8일
This will find all the uifigures you have open and store them in the variable f. Then you can delete them or whatever you want.
f = findall(groot(),'Type','figure');
is_uifig = false(numel(f),1);
for ii = 1:numel(f)
is_uifig(ii) = matlab.ui.internal.isUIFigure(f(ii));
end
f = f(is_uifig);

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by