How to get graphics array content App Designed

2 visualizaciones (últimos 30 días)
Joannes Olondriz Erdozain
Joannes Olondriz Erdozain el 1 de Feb. de 2024
Respondida: Steven Lord el 1 de Feb. de 2024
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!

Respuesta aceptada

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

Más respuestas (1)

Steven Lord
Steven Lord el 1 de Feb. de 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.

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by