Can you continue with subsequent lines of code while waiting for user input?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I know that it isn't possible to run two scripts at once in MATLAB, however I would like to know if it is possible to execute commands in a script while waiting for user input, rather than pausing until an input is given? I have an array of white dots which is gradually changing to become more symmetrical (by deleting half the dots and replacing with reflections (in the vertical midline) of the other half). A certain percentage of the dots are changed, the new image of the array replaces the last one, and the script is paused for 0.01s. This continues for about 20 secs, until all the dots have been replaced (so the array is 100% symmetrical) I want the user to press enter when they think they can see the symmetry, and for the iterations which gradually transform the array (by replacing dots and then pausing) to stop when they press enter.
therefore my first line of code would be
input('press enter when it looks symmetrical')
but I would then want to run through the iterations which make the array look more symmetrical, until user input is given, at which point the iterations should stop. I could then obtain data such as the time it took for the user to recognize the symmetry, or the % of dots which were symmetrically arranged when they did recognize it.
Any suggestions? Can I execute other commands until user input is given?
0 Commenti
Risposta accettata
Matt J
il 25 Ago 2014
Modificato: Matt J
il 25 Ago 2014
I don't know how you're displaying your array. A natural way to do this would be to make a GUI application in GUIDE . You can create a GUI window with a start button to start the evolution process, an axes to display your evolving image, and a stop button for the user to say when the array has evolved enough. The start button callback would run the array evolution process, but you would set its Interruptible property to 'on' and you would write the callback so that it would periodically check the GUI figure window's appdata for a stop flag. The stop button would be used to set this flag, using guidata.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!