uiwait/uiresume through uicontrol can be used to pause/continue a loop. Is there a corresponding ui+... to start over a loop from scratch that already finished running?

 Réponse acceptée

Jon
Jon le 1 Mar 2024
Modifié(e) : Jon le 1 Mar 2024

0 votes

Not sure from your description exactly what you are trying to accomplish, but lets say you want to run the loop whenever the user pushes a button on the UI. Then just have the callback function for the button press initialize and run the loop.

4 commentaires

feynman feynman
feynman feynman le 2 Mar 2024
I want to re-run the loop whenever the user pushes a button on the UI. Then which callback function?
Jon
Jon le 5 Mar 2024
Use the ButtonPushedFcn callback
In app designer navigate to the Design View:
  1. Select (click) the button you want to have the user press to rerun the loop
  2. In the panel on the right hand side, lower half you will see two tabs Button|Callbacks, select the Callbacks tab
  3. You will see the text ButtonPushedFcn and next to it a drop down menu
  4. Select from the drop down menu <add ButtonPushedFcn callback>
  5. The view will switch to code view, and the cursor will be in the first line of the code you need to add to rerun the loop, when the user presses the button
feynman feynman
feynman feynman le 9 Mar 2024
Modifié(e) : feynman feynman le 9 Mar 2024
Thank you very much for your help. Now I learnt how to add such a button in an app. I would like to add such a button to a figure rather than in an app, then what can we do?
Voss
Voss le 9 Mar 2024
You can use GUIDE, or you can create the button programmatically using the uicontrol function or the uibutton function if your figure is a uifigure.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by