필터 지우기
필터 지우기

dealing with objects being deleted

조회 수: 11 (최근 30일)
Hannah
Hannah 2013년 5월 20일
So I am having a problem with the error ' Invalid or deleted object'. My program gets some data from a database after a button click. It first reads the user date input to get the specific date to query from and then gets all the data I need. it then graphs the data. I am imitating a tab functionality, which is really just 5 different buttons that graph five different sets of data (I got all the data from the fisrt button push). SO the problem is that I initially use the clearing function that basically resets the GUI window:
close(gcbf)
Pool36ex_GUI_ACESv4
BUT everytime i change a 'tab', I want to clear the window and regraph with a new set of data (so they dont overlap), AND add text to the edit box that displays the date! But i get the error above because I guess when I clr and reset the window it deletes all the objects, and I get the above error. Is there a way around this?

답변 (1개)

Walter Roberson
Walter Roberson 2013년 5월 20일
No, in MATLAB, a "window" is the same thing as a "figure", so if you clear the window then you clear everything in the figure including the GUI.
You should consider instead clearing only the appropriate axis; or you could put components within a uipanel and then clear the contents of the uipanel.
  댓글 수: 2
Hannah
Hannah 2013년 5월 20일
Ah man... So even saving it another variable would clear that variable? Because I know I'm saving some arrays and they dont erase when I use the clearing function, but that also might be because they aren't objects.
Walter Roberson
Walter Roberson 2013년 5월 20일
If you delete() a figure, then all graphics objects under it will be deleted, even if their handles are stored somewhere. You could copyobj() if the situation called for it, but I would not recommend it in the code structure you describe.

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

카테고리

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