Open folder selection dialog box
opens a modal
dialog box that displays the folders in the current working directory and returns
the path that the user selects from the dialog box.
selpath = uigetdir
This dialog box enables a user to navigate to a folder and select it (or type the
name of a folder). If the specified folder exists, then MATLAB® returns the selected path as a character vector when the user clicks
OK. If the user clicks Cancel or the close button (X) on the title bar, then MATLAB returns
specifies the start path in which the dialog box opens. If
selpath = uigetdir(
is empty or is not a valid path, then the dialog box opens in the current working
The visual characteristics of the dialog box depend on the operating system that runs your code. For instance, some operating systems do not show title bars on dialog boxes. If you pass a dialog box title to the uigetdir function, those operating systems do not display the title.
path — Initial folder
current working directory (default) | character vector | string scalar
The initial folder in which the dialog box opens, specified as character vector or string scalar.
title — Dialog box title
Select Folder to Open (default) | character vector | string scalar
The dialog box title, specified as a character vector or string scalar
Modal Dialog Box
A modal dialog box prevents a user from interacting with other MATLAB windows before responding to the dialog box.
Introduced before R2006a