필터 지우기
필터 지우기

How to reset default values by button press in GUI?

조회 수: 19 (최근 30일)
Nimra Azmat
Nimra Azmat 2019년 6월 30일
편집: Shameer Parmar 2019년 7월 1일
How can i get the default or initial values of the silder and edit box on pressing the Reset All button
ma.JPG
  댓글 수: 2
Adam Danz
Adam Danz 2019년 6월 30일
One way to reset the GUI state is to store the default values in the callback function to the Reset All button. When that button is pressed, the callback function would merely assign the default value to the GUI components.
Another way would be to merely close the gui and re-open it when the Reset All button is pressed but the first option is faster and safer.
Jan
Jan 2019년 6월 30일
What have you tried so far? With GUIDE or AppDesigner it should be more or less trivial to set the values of objects in a callback. So please post, what you have tried so far and which problem you have.

댓글을 달려면 로그인하십시오.

답변 (1개)

Shameer Parmar
Shameer Parmar 2019년 7월 1일
편집: Shameer Parmar 2019년 7월 1일
Hello Nimra,
Open your .m file and go to callback of pushbutton 'ResetAll'
then mention the following commands..
set(handles.slider1,'Value',0);
% Here instead of '0' you can put your default value.
set(handles.edit1,'string','');
% Here instead of '' you can put your default string.
Please check if this works for you or you need any more help..

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by