Display GUIDE GUIs in random order?

조회 수: 1 (최근 30일)
Muaaman
Muaaman 2014년 12월 17일
댓글: Davide Rambusi 2018년 3월 2일
I have 14 GUIDE GUI's and I want them to appear in a random order, one after another.
i.e. GUIDE GUI #1 opens, press push button and then the next GUIDE GUI pops up (e.g. GUIDE GUI #2) and GUIDE GUI #1 closes. The next GUIDE GUI that comes is random (one of the 13 that remain)
How may I about doing that?
Any relevant input would be greatly appreciated.

답변 (1개)

Adam
Adam 2014년 12월 17일
Assuming you mean a pushbutton on some separate controlling GUI rather than on the GUI just opened, the the OpeningFcn you can define:
handles.guideGUIs{1} = @GuideGui1;
handles.guideGUIs{2} = @GuideGui2;
...
handles.guideGUIs{14} = @GuideGui14;
handles.hGUI = [];
then in the pushbutton's callback you can have something like:
delete( handles.hGUI );
r = randi( numel( handles.guideGUIs ) );
handles.hGUI = handles.guideGUIs{r}();
handles.guideGUIs(r) = [];
guidata( hObject, handles );
That is meant as a framework rather than something that will necessarily work exactly if you paste it in - I wrote it off the top of my head so haven't actually created a GUI to test it out (though I did test the function handle launching).
  댓글 수: 5
Adam
Adam 2014년 12월 19일
The
guidata( hObject, handles )
line assumes this is all going in a GUIDE-based GUI with a pushbutton in it.
If that is the case then there shouldn't be any saving to mat files needed. The handles structure is part of the GUI, you should never load in a handles structure from file in a GUI.
If it isn't run from a GUI then you don't need guidata and probably shouldn't name the structure 'handles'.
Davide Rambusi
Davide Rambusi 2018년 3월 2일
And how to do it, if we assume the button is in the GUI just opened? Like you have a GUI that is the one where you insert basic information, then you click start and it launches the first GUI, then this just opened GUI will have a "continue" button that closes this GUI and open another one, that will have another "continue" button and so on

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

카테고리

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