How to create reset button GUI

2 visualizaciones (últimos 30 días)
Taewa kaewplang
Taewa kaewplang el 23 de Mayo de 2012
Comentada: Walter Roberson el 26 de Ag. de 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 .

Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de Mayo de 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 comentarios
Mahdi Ghourchian
Mahdi Ghourchian el 21 de Ag. de 2019
Editada: Mahdi Ghourchian el 21 de Ag. de 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 el 26 de Ag. de 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.

Iniciar sesión para comentar.

Más respuestas (1)

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

Iniciar sesión para comentar.

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by