Moving selected entry from a listbox to another listbox and adding more to the list
Mostrar comentarios más antiguos
Hi,
I'm trying to move one entry at a time from a listbox (channelList) to another listbox (importList). I can't figure out how to get it to add multiple entries without overwriting the previous entry. I select a choice on my first listbox, channelList, hit my pushbutton that will move it to the other listbox, importList, it works. I get the correct entry in importList. However, if I need to add another entry to importList, I select one from the first listbox, channelList, hit my move to importList pushbutton, and it will just overwrite the first entry. I don't know how to get around this and make the second list box actually be a list and not just a single entry.
Here is my pushbutton code:
entries = cellstr(get(handles.channelList,'String'))
selected = entries{get(handles.channelList,'Value')}
set(handles.importList,'String', selected)
Thanks ahead of time.
Edit: I tried to use an array with an index but for some reason it still just erases the previous entry...
entries = cellstr(get(handles.channelList,'String'));
selected = entries{get(handles.channelList,'Value')};
selectedList(handles.index) = [{selected}]
handles.index = handles.index + 1
guidata(hObject,handles)
set(handles.importList,'String', selectedList);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!