MATLAB: Multiple Popup menus in a GUI

matlab gui

Hello,
I am relatively new to MATLAB GUI. I am working on creating a bunch of popup menus for an application.
If I have two popup menus I can easily have tags popupmenu1 and popupmenu2 and access the content of those menus. But, I need more than 20 popupmenus. Is there a way to tag the popup menus using tags like: popupmenu(1), popupmenu(2)…. so that I can have an array of popupmenus. Creating an array of popupmenus will make it easy for me to access the contents of that menu
Really Appreciate the help
Thanks, Santosh

Best Answer

A tag is a text string; you can use the string 'popupmenu(1)', but that is just a string and does not signal an array.
If you are trying to use GUIDE then using any character other than A-Z a-z 0-9 or underscore will cause you problems, I believe.
You can store the handles in an array. For example,
for K = 1 : 10
H(K) = uicontrol('Style', 'pop', 'String', {sprintf('#%d', K)}, 'Units', 'norm', 'Position', [rand,rand,0.05,0.05]);
end
and you can stuff that away in "handles" if you are using the handles structure:
handles.popups = H;
guidata(gcf, handles);