Initialize GUI plot area

조회 수: 1 (최근 30일)
Zhenjia
Zhenjia 2015년 4월 28일
댓글: Image Analyst 2015년 4월 29일
Hi, I created a GUI with a "Run" button and a "Plot" area using GUIDE. I want the plot area to be blank when the GUI is open. After clicking "Run", the curves show in the plot area. However, there is always an existing plot in the plot area when I open GUI. If I don't click "Run" button, there are no variables to plot curves. I am confused how GUI save my previous plot there, and how I can clear them. Thanks.(Matlab R2015a)
  댓글 수: 2
Joseph Cheng
Joseph Cheng 2015년 4월 28일
stupid question here but are you sure that you closed the GUI before you execute the GUI again? That is the only way i can think of data still remaining to be plotted.
Zhenjia
Zhenjia 2015년 4월 28일
Yes, I am pretty sure I close it. I totally operate from the beginning. Open Matlab, type in guide, then click run. The curves are in the plot area before I click the "Run" button on my GUI.

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

답변 (1개)

Image Analyst
Image Analyst 2015년 4월 28일
Before you plot the stuff you want to plot and see, issue this command:
cla reset;
  댓글 수: 3
Joseph Cheng
Joseph Cheng 2015년 4월 28일
편집: Joseph Cheng 2015년 4월 28일
if that is the case you would put what Image Analyst suggested in the
(yourGUIname)__OpeningFcn(hObject, eventdata, handles, varargin)
portion. This is where you can initialize items before the figure is made visible.
I would go through using the debug mode and step through and see where the plotting occurs to understand where it is coming from. Is there code left over from a createfcn that wasn't deleted.
Image Analyst
Image Analyst 2015년 4월 29일
They're not just going to show up on their own after you've just created the axes or just cleared them. You have code to make them do the plot. Find every place where you call plot() and set a breakpoint there. Find out where you're doing the plotting that you don't want to do and delete those lines or prevent it somehow (like put into an "if" block or something).

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

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by