MATLAB Function Reference    
mkdir

Make new directory

Graphical Interface

As an alternative to the mkdir function, you can click the icon in the Current Directory browser to add a directory.

Syntax

Description

mkdir('dirname') creates the directory dirname in the current directory.

mkdir('parentdir','dirname') creates the directory dirname in the existing directory parentdir, where parentdir is an absolute or relative pathname.

[status,message,messageid] = mkdir(...,'dirname') creates the directory dirname in the existing directory parentdir, returning the status, a message, and the MATLAB error message ID (see error and lasterr). Here, status is 1 for success and is 0 for no error. Only one output argument is required.

Examples

Create a Subdirectory in Current Directory

To create a subdirectory in the current directory called newdir, type

Create a Subdirectory in Specified Parent Directory

To create a subdirectory called newdir in the directory testdata, which is at the same level as the current directory, type

Return Status When Creating Directory

In this example, an attempt to create newdir fails because the directory already exists, and the error information is returned:

See Also

copyfile, cd, dir, fileattrib, filebrowser, ls, movefile, rmdir


  mislocked mkpp