findobj not working with UIAxis

11 views (last 30 days)
Maximilian Schulte
Maximilian Schulte on 7 Feb 2024
Answered: Voss on 7 Feb 2024
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)

Answers (1)

Voss
Voss on 7 Feb 2024
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.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!