Clear Filters
Clear Filters

How to move from one gui page to another by clicking push button?

9 views (last 30 days)
hi,I am new to matlab.I have a problem.I have created a simple gui page in matlab, it has a next button. Now I want to go to the next gui page by clicking on this button, such that first gui closes and next appears. What should I code in the callback? Do I need to use uicontrol? What exactly in the uicontrol?
something like this:
uicontrol('style','push','call','figure(''s.fig'',''new Figure'') close(gcbf)');
however this doe not seem to work..:(

Accepted Answer

Paulo Silva
Paulo Silva on 21 Apr 2011
Maybe your are looking for something like this Multiple Tab GUI
Eslam Hamed
Eslam Hamed on 18 Dec 2015
Edited: Eslam Hamed on 18 Dec 2015
Thanks a lot Paulo silva for this smooth and easy answer in your first comment, thanks matt for your addition, saved my day guys :))
Ankit Surti
Ankit Surti on 2 Apr 2017
I'm getting this error can you help me with this?
Undefined function or variable 'welcomepage'.
Error in>@(hObject,eventdata)welcomepage('pushbutton1_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback.
even i want to implement the same concept but stuck with this error!!

Sign in to comment.

More Answers (3)

Matt Tearle
Matt Tearle on 21 Apr 2011
I do this for things like help windows:
  1. Set the 'Tag' property in each window
  2. In the callback, use findobj to find the handle to the desired tag
  3. Check to see that it actually exists
  4. If so, use figure to make it active
Sample callback:
function showhelp(hObject,eventdata)
h_help = findobj('Tag','RCChelp');
if (isempty(h_help))
% Do something here -- window doesn't currently exist
You could simplify all this to figure(findobj('Tag','xxxx')), if you wanted to inline it.

Image Analyst
Image Analyst on 11 Jan 2015
With R2014b you now have tabbed panels: : "Create user interfaces with tab panels with uitabgroup and uitab functions."

Savannah Morrissey Martin
Savannah Morrissey Martin on 11 May 2018
Could you tell me how you set up your next button? I am trying to do something similar.


Find more on Migrate GUIDE Apps 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!