Updating listbox when deleting items
Afficher commentaires plus anciens
Hi,
I am currently creating a GUI with GUIDE on MATLAB 2010 and I have a rather strange issue. I have two listbox (listbox1 and listbox2) and when pressing "enter" when focus on listbox1, said item appears in listbox2 (cell array and use of "unique" to avoid duplicate). listbox1 is not altered. Then, by pressing "enter" with focus on listbox2, I delete said item from listbox2. So, being a newbie, I had at first the notorious "Warning: single-selection listbox control requires that Value be an integer within String range Control will not be rendered until all of its parameter values are valid "
So I add some code to set Value at 1.
And then it became strange. The code works perfectly fine when I am doing it step by step on the debug tool, but as soon as I go back to normal, the warning re-appears.
Here is my code:
if strcmp(eventdata.Key, 'return')
handles.exp_names = handles.exp_names(~strcmp(handles.exp_names,handles.exp_deletion));
set(handles.listbox2,'Value',1);
refreshdata(handles.listbox2);
set(handles.listbox2,'String',handles.exp_names);
set(handles.listbox1,'visible','on')
guidata(hObject,handles);
end
Any idea of why this happens ?
Thank you
Vincent
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!