필터 지우기
필터 지우기

Reset button in Matlab GUI

조회 수: 65 (최근 30일)
Matt
Matt 2013년 5월 10일
답변: Sittichai Ouamaimphuet 2022년 3월 2일
Hello
I am working with Mat lab GUI and it works. But I need to add a reset button so that that when the user wants to input other parameters, it clear all the input data and figure of the previous result.
Any idea please how to implement this.
Thank you
Matt

채택된 답변

David Sanchez
David Sanchez 2013년 5월 10일
In the reset button callback function just add the code to modify the boxes you need to reset.
set(handles.yourbox1,'string',num2str(0)); ...
once the user inserts the new values in the corresponding boxes, these will overwrite the old ones, if you code works as it should.
  댓글 수: 1
Matt
Matt 2013년 5월 10일
Thanks! I also found this answer!"Say your GUIs name is MYGUI. Then put this in the callback for the pushbutton:
close(gcbf) mygui
And it also resets all data on the Edit box! BUt still i cant reset the plots on my axis! How can i do this?

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

추가 답변 (3개)

David Sanchez
David Sanchez 2013년 5월 10일
to reset the plot use:
clf
type
help clf
for all the information you'll need
  댓글 수: 2
Matt
Matt 2013년 5월 10일
Thanks again!
I add clf(handles.Diagram1,'reset') before the plot command and every time it plots it overwrites the previous fig! This is nice! But one more thing I need is. when the user press the Reset button like all the box are empty when i use [close(gcbf) mygui] I want also to see the plot axis to look empty at the beginning. When i click the Reset button it still shows me the figure from previous plot although it reset it with new figure when the result display!
So i just need my plot axis to look empty when i click the reset button. How to achieve this?
Thanks
Jonathan
Jonathan 2013년 8월 21일
Hi, I think what you want to do is:
cla(handles.Diagram1,'reset')
If Diagram1 is the tag to the axes object in your gui. I found clf didn't work as expected so changed to cla and upon pushing the reset button in my gui it cleared the figure to be blank.

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


Sittichai Ouamaimphuet
Sittichai Ouamaimphuet 2022년 3월 2일
cla(handles.Diagram1,'reset')

Sittichai Ouamaimphuet
Sittichai Ouamaimphuet 2022년 3월 2일
cla(handles.Diagram1,'reset')

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by