MATLAB: How to insert elements in listbox guiguideimageimage processing how can i insert list of images into listbox?? I have a folder containg images and i want to insert list of images into the listbox Best Answer Hi, Usama.Maybe you are seeking for something like this?In the openingfcnfunction untitled_OpeningFcn(hObject, eventdata, handles, varargin)handles.output = hObject;files = dir(fullfile(pwd,'Folder01','*.png'));for x = 1 : length(files) handles.images{x} = imread(fullfile(pwd,'Folder01',files(x).name));endset(handles.listbox1,'string',{files.name});guidata(hObject, handles);In the listbox1 callbackfunction listbox1_Callback(hObject, eventdata, handles)handles.output = hObject;index = get(handles.listbox1,'value');imshow(handles.images{index});guidata(hObject, handles);You can also change the image extention by replacing png with another extentionEq: files = dir(fullfile(pwd,'Folder01','*.jpg'));And if it is DICOM filesfiles = dir(fullfile(pwd,'Folder01','*.dcm'));for x = 1 : length(files) handles.images{x} = dicomread(fullfile(pwd,'Folder01',files(x).name));endI hope this helps. Related SolutionsMATLAB: How to call a function into a pushbutton GUI OK, my bad , i did not used the good push button ...... :)So its work with this script inside the pushbutton :files = dir(fullfile(pwd,'manoeuvres','Calage_*')); set(handles.listbox2,'String',{files.name}); guidata(hObject, handles); MATLAB: Problem about DICOM Image GUI dinfo = dir('*.dcm');dcm_files = {dinfo.name};set( handles.listbox1, 'String', dcm_files);...function listbox1_Callback(src, event, handles) box_choices = get(src, 'String'); box_chosen = get(src, 'Value'); file_chosen = box_choices{box_chosen}; [ImageData, ImageMap] = imread(file_chosen); imshow( ImageData, ImageMap, 'Parent', handles.axes_to_display_in); axis(handles.axes_to_display_in, 'image'); Related QuestionHow to insert image file name in listbox and show preview
Best Answer