How to create reset button GUI
5 views (last 30 days)
Show older comments
Taewa kaewplang
on 23 May 2012
Commented: Walter Roberson
on 26 Aug 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 Comments
Accepted Answer
Walter Roberson
on 23 May 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 Comments
Mahdi Ghourchian
on 21 Aug 2019
Edited: Mahdi Ghourchian
on 21 Aug 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
on 26 Aug 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.
More Answers (1)
Taewa kaewplang
on 23 May 2012
1 Comment
Walter Roberson
on 23 May 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))
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!