How to create reset button GUI

5 views (last 30 days)
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 .

Accepted Answer

Walter Roberson
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
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
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.

Sign in to comment.

More Answers (1)

Taewa kaewplang
Taewa kaewplang on 23 May 2012
And , if click reset button back to start openingFcn ?
Thank you
  1 Comment
Walter Roberson
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))

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!