Display GUIDE GUIs in random order?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponses (1)
Adam
le 17 Déc 2014
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 commentaires
Adam
le 19 Déc 2014
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
le 2 Mar 2018
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
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!