필터 지우기
필터 지우기

update GUI from from call back

조회 수: 1 (최근 30일)
Oliver Warlow
Oliver Warlow 2013년 7월 18일
Hi I am new to using GUIs in Matlab so this is probably something simple!
I have created a GUI using the GUIDE template. It has a popup menu and a listbox. I want the contents of the listbox to be dependent on what has been specified in the popup menu. In the callback function of the popmenu I use the commands:
contents = cellstr(get(hObject,'String'));
handles.Selection = contents{get(hObject,'Value')};
guidata(hObject, handles);
This updates the field handles.Selection which is used to populate the listbox
How do I now get the GUI to update the listbox with the new value of handles.Selection? Is there come kind of function command I need to do this?
thanks
Oli

채택된 답변

Evan
Evan 2013년 7월 18일
편집: Evan 2013년 7월 18일
Does this do it?
set(handles.listbox_handle,'String',contents{handles.Selection})
Also, I'm fairly sure that you don't need the cellstr function when getting "contents."
  댓글 수: 2
Oliver Warlow
Oliver Warlow 2013년 7월 18일
yep that works perfectly thanks, Oli
Evan
Evan 2013년 7월 18일
No problem!

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

추가 답변 (0개)

카테고리

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