findobj not working with UIAxis

조회 수: 11 (최근 30일)
Maximilian Schulte
Maximilian Schulte 2024년 2월 7일
답변: Voss 2024년 2월 7일
I have an app with tabs and Axis as Children.
When using
axesInTab = findobj(currentTab, 'Type', 'matlab.ui.control.UIAxes');
i get 0x0 GraphicsPlaceholder but when using
% Direktes Zugreifen auf Children-Eigenschaft
children = currentTab.Children;
% Filtern der Children, um nur UIAxes zu erhalten
axesInTab = children(arrayfun(@(c) isa(c, 'matlab.ui.control.UIAxes'), children));
I can find the Axis as expected.
Anybody has an idear? (Btw second Function is from ChatGBT lol)

답변 (1개)

Voss
Voss 2024년 2월 7일
The 'Type' and the class of something are two different things.
The value of the uiaxes 'Type' property is 'axes', so
axesInTab = findobj(currentTab, 'Type', 'axes');
will work.
The uiaxes is of class 'matlab.ui.control.UIAxes', so that's why isa(_,'matlab.ui.control.UIAxes') returns true for it.

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by