Hi ! I need to create a multiple GUI with Matlab, i.e. a GUI made of more panels, where each panel, containing more commands (push buttons, edit texts, axes…), can be visualized separately (hiding the other panels) by pressing a Push button. For example, I created a panel, called Panel_1, like this
Now I want to create another panel, let'say Panel_2, with other commands. Then, I want to visualize one of the two panels separately (and acting on its commands) by selecting an appropriate push button, like this:
Let's call uipanel1 and uipanel2 the tags associated to the two panels, and pushbutton_panel1 and pushbutton_panel2 the tags associated to the two push buttons. By pressing push button "Panel_1" I want to visualize the Panel_1 and act on its commands, by pressing push button "Panel_2" I want to visualize the Panel_2 and act on its commands. Of course, when working in Panel_2 I want to be able to recall functions associated to the commands contained in Panel_1. These are the callback functions I wrote, associated to the push buttons:
% --- Executes on button press in pushbutton_panel1.
function pushbutton_panel1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton_panel1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.uipanel1,'visible','on')set(handles.uipanel2,'visible','off')% --- Executes on button press in pushbutton_panel2.
function pushbutton_panel2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton_panel2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.uipanel1,'visible','off')set(handles.uipanel2,'visible','on')
But it doesn't work: when I press Run, I see this:
When I press Push button 'Panel_1' , I see this:
and, when pressing Push button 'Panel_2', I see nothing:
Can you help me to solve this? Thanks!
Best Answer