MATLAB: Popup selection dictated by button selection

guipopup menupushbutton

I have 2 push buttons on my GUI.
When I push pushbutton 1, I want popup menu 1 to show, similarly when I push pushbutton 2 I want popup menu 2 to show. During start up I don't want any popup menus to show, only the pushbuttons.
In other words I would like the pushbutton selection to determine the popup menus.

Best Answer

Set the Visible property to both popups to false/off. Then in the callback for button 1, set the visibilities
handles.popup1.Visible = 'on'; % or 1 - not sure.

handles.popup2.Visible = 'off'; % or 0 - not sure.

In the callback for button 2, set the visibilities
handles.popup1.Visible = 'off'; % or 0 - not sure.
handles.popup2.Visible = 'on'; % or 1 - not sure.
If you have an old version and the OOP way of setting properties doesn't work, then use set():
set(handles.popup1, 'Visible', 'off');