findobj not working with UIAxis

10 visualizaciones (últimos 30 días)
Maximilian Schulte
Maximilian Schulte el 7 de Feb. de 2024
Respondida: Voss el 7 de Feb. de 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)

Respuestas (1)

Voss
Voss el 7 de Feb. de 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.

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by