determining number of axes on a figure

11 visualizzazioni (ultimi 30 giorni)
Art
Art il 10 Apr 2012
Commentato: Massimo Ciacci il 16 Nov 2021
how can I determine the number of axes that a figure has?
using get(figure,'Children') works but also gives data on non-axis children, which I don't want

Risposte (2)

Walter Roberson
Walter Roberson il 10 Apr 2012
Do you only want axes that are immediate children, or do you want all axes, even those that might be several objects down (such as within uipanel) ? And how about if the handles are hidden, do you want them returned or not?
Immediate children only:
findobj( get(gcf,'Children'), '-depth', 1, 'type', 'axes')
All children (including hidden) at all levels:
findall(gcf, 'type', 'axes')
  5 Commenti
Art
Art il 11 Apr 2012
that works - thanks
Massimo Ciacci
Massimo Ciacci il 16 Nov 2021
Awesome tip, didn't know about '-depth'. Works a charm.

Accedi per commentare.


Daniel Shub
Daniel Shub il 10 Apr 2012
findobj(gcf, 'type', 'axes')

Categorie

Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by