mkdir
Creates the directory newdir in the current working directory by default.
Syntax
[R1, R2] = mkdir(newdir)
[R1, R2] = mkdir(parentdir, newdir)
Inputs
- newdir
- Name of new directory to create (absolute or relative path). If nargin is 2, newdir is the second argument.
- parentdir
- Name of parent directory within which to create newdir. If nargin is 2, this is the first argument.
Outputs
- R1
- Returns 1 if successful; returns 0 if not successful.
- R2
- Returns an error message if the command is not successful (R1 is 0).
Examples
mkdir('Test')
ans = 1
mkdir('C:','Test')
ans = 1
[R1, R2] = mkdir('C:','Test')
R1 = 0
R2 = directory exists
Comments
If the variable parentdir is provided, the command creates the directory newdir in the parent directory.