Hi there, I'm trying to add new (and only new) elements to my initially empty GUI Listbox, but it just doesn't work out. Here's my code for the pushbutton callback :
function pushbutton2_Callback(hObject, eventdata, handles)Items_2 = {};handles = guidata(hObject);folder = handles.folder;pathname = folder;Item_1 = handles.selectedItemStr; %Comes from another listbox.
guidata(hObject, handles)while ~strcmpi(Items_2, Item_1) %When the Item_1 is allready in Items_2, the While Loop ends by itself and Items_2 stays the same.
Items_2 = [Item_1, Items_2]; % However, in the contrary, Item_1 is added to the Items_2 (cell arrays of string characters)
set(handles.listbox2,'String',Items_2); %Update the list in Listbox2.
breakend
Here's my code for the listbox 2 callback :
function listbox2_Callback(hObject, eventdata, handles)%I don't think I need to do this, but I do it anyway.
list = get(handles,'String');set(handles,'String',list);
When I run my GUI, it shows no error, but the list doesn't update nor doesn't add any new item.
Thanks for the help!
Best Answer