How to change the GUI content when selecting different menu buttons?

8 次查看(过去 30 天)
Hi all,
Using GUIDE, I am developing a GUI which controls 3 different aspects of analysis work: input data, presentations and analysis.
I want to have three menu buttons for each of these (I know how to add menu buttons to a GUI). I want that each time a menu button is selected all the content of the main GUI figure - all the controls that the user see - will change. Much like the behavior of apps on a smartphone.
I know that I can create some buttons on the main GUI that, when being pushed, will open another GUI which will do the job. However, I want the more 'sexy' way of having to work with only one GUI.
Is there a way to do it?
Thanks, Alon
  2 个评论
Romano Geerling
Romano Geerling 2016-11-15
To give a simple answer, yes you can.
However creating a GUI like this requires you to put all the controls into a uipanel and set the visibility to on and off when the user selects something from the menu. Does the menu only contains 3 options, then it might not be such a big issue.
If you create much more options the code is maybe harder to read and maintain and the performance might go down. Although you set the visibility of the uipanel to off all the code will still be executed by MATLAB.
Alon Rozen
Alon Rozen 2016-11-16
Thanks Romano,
It turns that it works :) See my comment to Adam - there is no trouble to maintain or activate the code - as he suggested.

请先登录,再进行评论。

采纳的回答

Adam
Adam 2016-11-15
You can do this programmatically quite easily. You can also do it in GUIDE with a little bit of programmatic addition, it is just a bit messy.
Basically you would need to put 3 panels on top of each other (using the object browser or 'send to back' option on the top panel) in GUIDE, with the functionality of each of your different GUIs in.
Then it is just a matter of making the other panels invisible and the one you want visible in response to the menu changing.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by