In Matlab, a directory called foo
can be created by calling mkdir('foo')
. If mkdir
is successful, then the function returns logical 1; otherwise it returns logical 0. Now consider the case where Matlab is run on Linux and there is already a file called foo
in the current directory. Linux does not permit the existence of a file and a directory of the same name in the same folder so the call to mkdir
should fail. Instead, mkdir
will leave the file intact, return logical 1, and print the misleading warning "Directory already exists". That is, there is no directory called foo
after this supposedly successful function call.
The peculiarity of this behavior has been reported to Mathworks in September 2015. The example above was tested with Matlab R2015b and R2014a on Linux.