Collecting User Inputs With Multiple GUI Windows?
Show older comments
Hi,
I have a Matlab simulation and I would like to create multiple GUI windows to obtain all the user inputs where once each window is completed, the user can proceed to the next window using a toggle button and once the last window is completed, the user can execute the simulation.
How can this be done using the GUIDE tool? I know how to create the GUIs and extract the data from the GUIs as input. My main problem lies with using two or more separate GUI figures subsequently for the same .m simulation file. Any guidance would be appreciated.
Accepted Answer
More Answers (2)
Geoff Hayes
on 12 Aug 2014
Another alternative would be to create one GUI with multiple uipanels that become visible (or invisible) as you cycle through the "wizard" steps. Each uipanel is located at the same position (and has the same width and height) as all others, but when the GUI starts, only uipanel1 is visible and all others are invisible. Callbacks for the next and previous buttons could determine which panels to hide and which one to show.
In a very simple example could be a GUI with two panels and three buttons (outside of the panels) near the bottom of the GUI labelled Previous, Next, and Finish. The first and last button are disabled if on the first panel. The second button is disabled if on the second panel. The callbacks for the previous and next buttons could look like
function pushbutton1_Callback(hObject, eventdata, handles)
% code for the previous pushbutton
set(handles.uipanel2,'Visible','off');
set(handles.uipanel1,'Visible','on');
set(handles.pushbutton3,'Enable','off');
set(handles.pushbutton2,'Enable','on');
set(handles.pushbutton1,'Enable','off');
function pushbutton2_Callback(hObject, eventdata, handles)
% code for the next pushbutton
set(handles.uipanel1,'Visible','off');
set(handles.uipanel2,'Visible','on');
set(handles.pushbutton3,'Enable','on');
set(handles.pushbutton2,'Enable','off');
set(handles.pushbutton1,'Enable','on');
As long as you don't have too many panels, and each panel doesn't become too busy with widgets, this is an option. And with all data (user choices) available within the one GUI, you don't have to worry about passing data back and forth between apps.
Joakim Magnusson
on 12 Aug 2014
0 votes
Maybe you can make tabs or a "next" button on each window and for example when you press next you open another gui and close the previous one? And pass the user input between the gui.
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!