MATLAB: How to Link Pushbutton and Listbox in Matlab GUI

matlab guipushbutton

I want Pushbutton to be used as browse button to browse appropriate folder location Once the Folder location is set by this pushbutton, ListBox should list the Files(M-Scripts). I am creating GUI using GUIDE.

Best Answer

chosen_dir = uigetdir('Select a directory');
dinfo = dir( fullfile(chosen_dir, '*.m') );
script_names = {dinfo.name};
set(handles.listbox1, 'String', script_names);
Related Question