MATLAB Answers

Das Bably

How to add several interfaces in one interface of MATLAB GUI

Asked by Das Bably
on 22 Feb 2013

Hi Actually I want to add different element in one GUI interface and by clicking different element different interfaces will be appeared for different calculation and will give different transfer matrices those will be calculated together by pressing pushbutton. Please if anybody have any idea tell me as I am trying from many days but don't know how to do it. Thanks to all




No products are associated with this question.

3 Answers

Answer by Mark Whirdy
on 22 Feb 2013
Edited by Mark Whirdy
on 23 Feb 2013
 Accepted answer

What is an "element", you mean a "uiobject" (uibutton, uitable etc?)?

Happy to help, but you'll have to work on the question clarity a little for me.

Do you want to create uicontrols programmatically when certain values are selected in other uicontrols?

In this case you'll need to put uicontrol() commands inside the callbacks of your "parent"/controlling uiobjects.


I'm afraid I can't describe the entire process of GUI-design here (which is really what your question requires) so it will be a case of doing a lot of background reading on your, unless you have a very specific task you want to achieve.

Start @

Broadly, your options are 1) use GUIDE to drag & drop objects into a figure 2) use the uicontrol() to generate uiobjects in a figure programmatically

In both cases you will then put code into the callbacks which changes the properties of the objects (the values in textboxes) when events are triggered (i.e. the user pushes a button)

If you want to make a group of objects appear & disappear then create them inside a uipanel (their parent should be the panel) and make the panel visible/invisible by



You can put this command inside the callback of a pushbutton (for example) to facilitate control of the panel.

I'd suggest that you play around with this stuff a little and come back to the Matlab Answers if you hit a specific hurdle along the way.

  1 Comment

Thanks a lot for your answer and sorry for late reply, Actually I have a design based problem and I made several script files for several calculations, I just want to decorate all the calculations in one GUI interface so that by cliking pushbutton for one section an innterface will be appeared and so on. So how this can be possible could you please tell me? Thanks Mark Whirdy

Answer by Lalit Patil on 23 Feb 2013

uicontrol( 'Style', 'push', 'Position', [20 190 250 30],'fontsize',10,'string','Your GUI name', 'Callback',@(src, event) GUI name() );

Write this script below opening function.. and at place Your GUI name write the name of that gui which you want to open..


Yes i tried by using the line you gave previously but there is a problem like when I run the main GUIDE then other inner GUDE is loded in main GUIDE but the inner GUIDE interface does not appear,so that I am not able to give seperate input in the inner GUIDE. If I want to enter several GUIDE interfaces in one I may need to several GUIDE interfaces previusly and then loaded in main GUIDE using your given lines, Am I right? Thanks for your cordial help

Thanks a lot I think I am able to enter multiple interfaces in single one but I need your kind help for another problem like I want to use the calculation part of a script file in MATLAB GUIDE m file in pushbutton calback but I am not getting the same result as like script file moreover in a matrix like form. Please if you have any suggestion give me Thanks again Lalit Patil

Hi I want to put many children interfaces in the main interface for that i want to get the pushbutton in main interfaces side by side instead of vertical position, for that what kind of change should I make in 'position'? Please give me any reply if it is known to you Thank you for your kind help

Answer by per isakson
on 25 Feb 2013
Edited by per isakson
on 25 Feb 2013


  1. uitab and uitabgroup (Matlab functions with hidden documentation - open the files)
  2. Tab panels – uitab and relatives
  3. TabPanel Constructor v2.8 (2010)
  4. search the File Exchange for more
  5. uitabpanel

  1 Comment

Thanks for your ans, I tried with tabpanel but it doesn't work as i am a beginner so i have lackings of vast knowledge.I am using version R2011a. I have alredy looked out all simple examples using GUIDE interface that creates interactive window, If you help me in coding inside the callback of GUIDE instead of Programmatically made GUI it will be more helpfull for me. thank you again

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!