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

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..:(

 채택된 답변

Paulo Silva
Paulo Silva 2011년 4월 21일

1 개 추천

Maybe your are looking for something like this Multiple Tab GUI

댓글 수: 8

Is there anything else that I can do? I want to move from one page to next,is it very difficult in matlab?
If you really want to call another GUI and close the one you are at the moment you just need to put in that button callback
s %name of the GUI to open
close(handles.figure1) %to close the old GUI
uicontrol('style','push','call','s;close(handles.figure1)')
That second approach won't work as callback strings are evaluated at the command prompt. If using a string, use:
uicontrol('style','push','call','s;close(gcbf)')
Thanks Matt Fig, I should have tested the code
Thanks Matt Fig and Paulo silva...:):)
Eslam Hamed
Eslam Hamed 2015년 12월 18일
편집: Eslam Hamed 2015년 12월 18일
Thanks a lot Paulo silva for this smooth and easy answer in your first comment, thanks matt for your addition, saved my day guys :))
I'm getting this error can you help me with this?
Undefined function or variable 'welcomepage'.
Error in matlab.graphics.internal.figfile.FigFile/read>@(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!!

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Matt Tearle
Matt Tearle 2011년 4월 21일
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
else
figure(h_help);
end
end
You could simplify all this to figure(findobj('Tag','xxxx')), if you wanted to inline it.
Image Analyst
Image Analyst 2015년 1월 11일

0 개 추천

With R2014b you now have tabbed panels: http://www.mathworks.com/products/matlab/matlab-graphics/ : "Create user interfaces with tab panels with uitabgroup and uitab functions."
Savannah Morrissey Martin
Savannah Morrissey Martin 2018년 5월 11일

0 개 추천

Could you tell me how you set up your next button? I am trying to do something similar.

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by