How to get graphics array content App Designed

2 views (last 30 days)
I have in a parent panel 4 push buttons and 2 children panels like this:
The number of children panels can vary, so I would like to read how many panels are. If I execute the command:
app.<Parent panel name>.Children, I get a graphics array of 6x1 (2=panels + 4=push buttons). Like this:
How can I read this cell array? Some equivalent to strcmp(ParentPanel,'Panel') to get an answer of an array like ([1 0 0 0 0 1]) and easily know with find command which members of the array are panels?
Thanks you in advance!

Accepted Answer

Voss
Voss on 1 Feb 2024
strcmp(get(ParentPanel.Children,'Type'),'uipanel')

More Answers (1)

Steven Lord
Steven Lord on 1 Feb 2024
Rather than searching for the panels after the fact, I'd probably create a property of your app that can contain a vector of handles to the panels.
When you create a panel, store its handle in that property.
If you delete a panel, remove it from that property.
When you need to operate on the panels, get that property and select the appropriate handle or handles from the vector.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!