MATLAB: Use of list box Matlab GUI digital image processingguiimage analysisimage processingmatlab gui Hi there, I want to know how can I link two list box and then pass the values of both list boxes in a text box using a push button. Any suggestion will be appreciated. Best Answer In the callback for the push button:str1 = cellstr(get(handles.listbox1, 'string'));val1 = get(handles.listbox1, 'value');if isempty(val1) selection1 = '';else selection1 = str1{val1};endstr2 = cellstr(get(handles.listbox2, 'string'));val2 = get(handles.listbox2, 'value');if isempty(val2) selection2 = '';else selection2 = str2{val2};endcombined_selection = {selection1; selection2};set(handles.textbox, 'string', combined_selection); Related SolutionsMATLAB: Listbox MATLAB GUI issue : How to pass two list box values to the 3rd listbox In the place you fetch the strings and values for the listboxes, also fetch the Enable property, and if it is not on then use the value (index) for the first listbox to index the second listbox as well. MATLAB: Loading items from listbox1 to listbox2 Add this: temp = get(handles.listbox2,'String'); temp{end+1} = filename; set(handles.listbox2,'String',temp) Related Question[GUI] How do you get only one element in a listbox
Best Answer