MATLAB: How to pre-select item in the listbox in the Matlab UI

guilistbox

I am creating the UI using GUIDE. I have one list box and I am populating the list of M files from particular folder using a pushbutton. What I would like to do is when listbox loads the list of M files, It should by default select the first item. Right now what I have to do is once, list of files is loaded, I have to click the file I want and the callback of listbox is selecting the file. I want to automate such that by default first item is selected.

Best Answer

Set the 'Value' for the listbox to 1 at the point when it is populated.