How to create reset button GUI
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Taewa kaewplang
le 23 Mai 2012
Commenté : Walter Roberson
le 26 Août 2019
I need a create reset button in gui . if click reset button will clear all value in program but I don't know function reset
Help me Please .
0 commentaires
Réponse acceptée
Walter Roberson
le 23 Mai 2012
set( findall(0, '-property', 'String'), 'String', {''});
arrayfun(@(H) set(H, 'Value', get(H, 'Min')), findall(0, '-property', 'Value', '-and', '-property', 'Min'));
You might perhaps be surprised at the effect that this has on uicontrol objects: for example, the content of all pop-up menus will disappear. As far as MATLAB is concerned, pop-up menus and listbox contents and pushbutton labels are "values", so they would be affected when you "clear all value in program". You could be more selective in what is cleared, but then it would not be all values.
2 commentaires
Mahdi Ghourchian
le 21 Août 2019
Modifié(e) : Mahdi Ghourchian
le 21 Août 2019
@Walter Roberson i have defined 12 push buttons which are movable.
I mean as soon as the operator run the matlab gui there are 12 push buttons which the operator can move .I used your code and it just clear the values the buttons as u mentioned.
But i want to define a button to clear the functionality of the other push buttons and not just the value.
I want to define a push button to reset my movable push buttons from movable into unmovable and a normal push button.
Do u have any idea?
Thnak u in advance
Walter Roberson
le 26 Août 2019
You can use code to change the Callback property of a pushbutton to alter the behavior of the button.
You can use code to alter the 'enable' property of a pushbutton so that it can no longer be clicked.
You can use code to alter the 'visible' property of a pushbutton so that it shows up or not.
You can use code to make one pushbutton invisible and a different pushbutton visible in much the same position.
Plus de réponses (1)
Taewa kaewplang
le 23 Mai 2012
1 commentaire
Walter Roberson
le 23 Mai 2012
openingFcn is something created by GUIDE, not part of MATLAB itself. I do not know what the effect of calling it in your program would be. You would probably have to start with something like
delete(findall(0))
Voir également
Catégories
En savoir plus sur Entering Commands 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!