MATLAB Function Reference    
mkdir

Make a new directory

Graphical Interface

As an alternative to the mkdir function, you can use the Current Directory browser to create new folders. To open it, select Current Directory from the View menu in the MATLAB desktop.

Syntax

Description

mkdir dirname creates the directory dirname in the current directory. It returns a status of 1 if the new directory is created successfully, 2 if it already exists. Otherwise, it returns 0.

mkdir parentdir dirname creates the directory dirname in the existing directory parentdir.

status = mkdir(...,'dirname') returns status and also returns a nonempty error message string in msg when an error occurs.

[status,msg] = mkdir(...,'dirname') returns status and also returns a nonempty error message string in msg when an error occurs.

Examples

To create a subdirectory of testdata called newdir,

This second attempt to create the same directory fails with an error message.

See Also

copyfile, filebrowser


 mislocked mlock