필터 지우기
필터 지우기

How to repopulate popupmenu by deleting old data.

조회 수: 2 (최근 30일)
Enrique
Enrique 2013년 8월 5일
Hi,
I am writing a program using GUI where I have two pop up menus that include dates of recorded data. When the user loads new data both pop up menus get filled by a cell-array vector that include dates from lower to higher order. The user then selects a date in popupmenu1 and another one in popupmenu2. The program then selects data from that range and plots it.
The problem is that when the user loads new data the popup menus repopulates but they keep the old dates; it writes the new dates above the old dates. My question is, how can I reset the pop up menu to default? (no string written on it, blank) so that I can then populate it with the new dates?

답변 (3개)

Evan
Evan 2013년 8월 5일
set(popup_handle,'String','')
That should do the trick.

Enrique
Enrique 2013년 8월 5일
편집: Enrique 2013년 8월 5일
Hi Evan,
I tried
set(handles.popupmenu1,'String','')
doesn't work
  댓글 수: 1
Evan
Evan 2013년 8월 5일
When you say "doesn't work" do you mean you get an error? Or does the list just not change?
If it's the latter, are you updating the handles structure after setting the string to empty?
guidata(hObject,handles)

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


Enrique
Enrique 2013년 8월 5일
Hey, I think the problem is in my original code and not in the GUI.
I believe I am not deleting the vector that contains the dates, so whenever I load new data they just get added to the old vector.
I will try "clear dates" and see what happens.
Thank you.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by