Reset button for GUI

조회 수: 9 (최근 30일)
jchris14
jchris14 2015년 9월 30일
댓글: Walter Roberson 2015년 10월 1일
I created a GUI for image analysis and contains just one button that lets you select the images and a plot axes to see a plot. I added a reset button with the intention of clearing the plot area and allowing you to work with different images. I used "cla" which cleared the axis however, it didnt completely reset the GUI for me to be able to work different images since the pan and zoom buttons i added into the GUI are grayed out.
Could you help write the code that completely wipes everything from the GUI's memory and reset it completely instead of closing and opening the program again. I converted the GUI in a .exe and the reset function would be extremely helpful for this.
thanks for the help

채택된 답변

Walter Roberson
Walter Roberson 2015년 10월 1일
  댓글 수: 2
jchris14
jchris14 2015년 10월 1일
I suppose in my situation, there really isnt a better way to reset other than reopen the GUI. I dont have any pop up menus, or radio buttons, or anything like that. I have one button that says select images which then does all the analysis and then plots.
Another question I have is, i created 2 buttons. One that does the analysis and the second prints the data as a CSV if pressed. However, the second button calls upon some variables that are created under the first push button. I get error, " variable is used but not assigned", how do i get around that?
thanks

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

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 9월 30일
Sorry, but there is no such function. If you monkey around with various controls (sliders, listboxes, axes, radio button, etc.) then there is no way to get them back just as if you started up from scratch. You'd have to know what they are and then reset them individually. What I do is have functions LoadUserSettings() and SaveUserSettings(). When I do something, like change a control or exit the program, I call SaveUserSettings where I read all the controls settings and save them to a mat file. Then when I launch the program, in the OpeningFcn function I call LoadUserSettings which reads the mat file and sends the values to the controls. You could call it anytime and include things like "cla reset".

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by