Can you create GUI Elements as an array? (Avoiding eval)
Afficher commentaires plus anciens
I'm working on a GUI that someone else started. Currently, we have text elements with tags: Section1OK, Section1Error, etc ... , Section2OK, Section2Error, etc ..., all the way up to 16. Because of this, when I want to work on these elements, my loop has to look something like this:
for i = 1:16 eval(['set(handles.Section',num2str(i),'OK,''Visible'',''off'');']) end
Which is annoying to look at.
Is there a way to rename/reorganize these elements so I can loop through them without using eval?
Réponse acceptée
Plus de réponses (1)
Daniel Shub
le 11 Mar 2013
eval(['set(handles.Section',num2str(i),'OK,''Visible'',''off'');'])
with
set(handles.(['Section',num2str(i),'OK']), 'Visible', 'off');
Catégories
En savoir plus sur Structures dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!