transfering string from one listbox to another
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all, I am trying to transfer string from one listbox to another. Below is the code I found in one of the forum. But it does not seem to work for me at all. Can anyone please help me with this.
list_entry = cellstr(get(handles.listbox1,'String'));
index_selected = list_entry{get(handles.listbox1,'Value')};
choice_listbox1 = list_entry(index_selected);
update_listbox2 = cellstr(get(handles.listbox2, 'String'));
newmenu = [choice_listbox1, update_listbox2];
set(handles.listbox2,'String', newmenu);
0 Kommentare
Antworten (2)
Walter Roberson
am 13 Jul. 2011
Close!
list_entry = cellstr(get(handles.listbox1,'String'));
index_selected = get(handles.listbox1,'Value'); %changed line
choice_listbox1 = list_entry(index_selected);
update_listbox2 = cellstr(get(handles.listbox2, 'String'));
newmenu = [choice_listbox1, update_listbox2];
set(handles.listbox2,'String', newmenu);
Asger
am 26 Aug. 2013
Try with newmenu =[update_listbox2; choice_listbox1]
I replaced the , with a ;
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!