Reset button

77 views (last 30 days)
Maryam Emad
Maryam Emad on 13 Dec 2011
Welcome All...
I have GUI with multiple Edit( To Get User Input ).
I wish to ADD Reset Pushbutton in order to clear All input.
How I can do it ?

Accepted Answer

Dr. Seis
Dr. Seis on 13 Dec 2011
You will have to hard-code this functionality. You will need to create a pushbutton and then under that new pushbutton function you will have to use "set" to restore all your edit boxes back to blank space or a default value. I.e.,
Walter Roberson
Walter Roberson on 13 Dec 2011
Well, findobj to locate the boxes whose String is to be set
This will, however, not work if you are using GUIDE, as GUIDE uses the Tag property for other things.

Sign in to comment.

More Answers (2)

Paulo Silva
Paulo Silva on 13 Dec 2011
set(findobj(0,'style','edit'),'string','') %put this in the button callback
%that should clear all edit uicontrols
%should only clear the edit uicontrols from the current GUI
Walter Roberson
Walter Roberson on 13 Dec 2011
set(findobj(handles.figure1,'style','edit', '-or', 'style','popupmenu'),'string','')

Sign in to comment.

Maryam Emad
Maryam Emad on 13 Dec 2011
Thanks .. Elige Grant & Paul Peeling
Grateful to you :)
What About this code , How do I take advantage of it ?
closeGUI = handles.figure1; %handles.figure1 is the GUI figure
% guiPosition = get(handles.figure1,'Position'); %get the position of the GUI
% guiName = get(handles.figure1,'Name'); %get the name of the GUI
% eval(guiName) %call the GUI again
% close(closeGUI); %close the old GUI
% set(gcf,'Position',guiPosition); %set the position for the new GUI


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!

Translated by