Displays a dialog for selecting existing file(s). Multiple files can be selected using the Ctrl key.


[name, filepath, index] = uigetfile()

[name, filepath, index] = uigetfile(filters)

[name, filepath, index] = uigetfile(filters, caption)

[name, filepath, index] = uigetfile(filters, caption, defaultname)

[name, filepath, index] = uigetfile(filters, 'multiselect', opt...)


Optional argument specifying the preferred file filter(s) or the default file name. If a file name is specified, its extension will be used as the preferred file filter. File filters can also be specified using a cell array of strings with at least two columns; the first column giving the filter and the second column giving a description.
Type: string | cell
Optional argument specifying the caption to be displayed for the dialog.
Type: string
Optional argument specifying the default name of the file to pick.
Type: string
Optional argument specifying if multiselection is allowed. Valid values are 'on' and 'off'. By default, multiselection is on.
Type: string


Name of the selected file(s). If multiple files are selected using the Ctrl key, the output will be a cell matrix of the selected files.
Type: string | cell
Optional output giving the path to the selected file(s).
Type: string
Optional output giving the filter index of the selected file(s).
Type: string


String input:
name = uigetfile('test.txt')
Default file filter displayed in the dialog is 'txt files (*.txt)'
String input with caption and default file name
name = uigetfile('*.txt', 'Open My File', 'test.oml')

Default file filter displayed will be 'oml files (*.oml)', with additional filters of 'txt files (*.txt)' and 'All files (*.*)' and caption of 'Open My File'
Cell input:
[name, filepath, index] = uigetfile({'*.txt;*.dat','Text files';'*.oml','Compose files'}, 'Open My File')

Default file filter displayed in the dialog is 'Text files (*.txt;*.dat)
String input with multiple selection disabled:
name = uigetfile('test.txt', 'multiselect', 'off')

Default file filter displayed in the dialog is 'txt files (*.txt)'. Only one file
can be picked.