필터 지우기
필터 지우기

MATLAB GUI - How can I get programmatically whether an 'axis' object is empty or not?

조회 수: 7 (최근 30일)
Paolo
Paolo 2013년 9월 23일
편집: Ahmed Ali 2022년 8월 26일
I have a MATLAB GUI, in which there is a figure (an 'axis' object). I would like to know programmatically whether there is or not a plot in that figure/axis, because I would like to add an 'axis limit' control. The code would be:
if figure_is_empty
axis([xMin xMax yMin yMax])
else
don't do anything, because there is nothing to 'resize'
end
Any suggestion?

답변 (1개)

Jan
Jan 2013년 9월 23일
The objects are called "axes" with "e".
If an axes contains any object, you find it in the list of its children:
isEmpytAxes = isempty(get(AxesHandle, 'Children'))
How the AxesHandle can be obtained depends on the details of your program.
The emptiness of a figure is something else: It means that the figure does not contain axes objects, buttons, menus etc. Notice that children can be hidden also, then allchild is useful:
allchild(gcf)
  댓글 수: 1
Ahmed Ali
Ahmed Ali 2022년 8월 26일
편집: Ahmed Ali 2022년 8월 26일
isEmpytAxes = isempty(get(AxesHandle, 'Children'))
Worked fine..thank you.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by