MATLAB: Populate a listbox with selected folder doc file names – App designer

app designerMATLAB

How can I populate a listbox with all doc files in a selected folder using a button in App designer?
function selectDocButtonPushed(app, event)
app.selectedPath = uigetdir();
docFileInfo = dir('*.doc')
app.docListBox.Items = docFileInfo.name
end

Best Answer

Give this a shot,
docFileInfo = dir(fullfile(app.selectedPath, '*.doc'));
app.docListBox.Items = {docFileInfo.name}';