findobj not working with UIAxis
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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)
0 Kommentare
Antworten (1)
Voss
am 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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!