MATLAB Answers

Why do I receive the warning message "Warning: Name is nonexistent or not a directory: .... " when I start MATLAB?

676 views (last 30 days)
I receive warning messages similar to the ones below whenever MATLAB starts up:
ERROR: Warning: Name is nonexistent or not a directory: c:\cdo\cdo analyzer\bin.
Warning: Name is nonexistent or not a directory: c:\cdo\cdo analyzer\bin\win32.
Warning: Name is nonexistent or not a directory: c:\cdo\cdo analyzer\toolbox.
Note: The warning message could be about different folders but essentially begins with "Warning: Name is nonexistent or not a directory".

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 15 Oct 2020
Edited: MathWorks Support Team on 15 Oct 2020
These warnings could be because of one the following possible scenarios.
1. The indicated directories are in the 'pathdef.m' file used by MATLAB, but the directories do not exist in the file system.
2. The directories are added to the MATLAB path using a custom 'startup.m' file and the directories do not exist in the file system.
To troubleshoot this issue, please type 'which -all pathdef.m' at the MATLAB prompt. The topmost line of the output represents the 'pathdef.m' file which is used by MATLAB.
If the topmost line in the output is NOT $matlabroot\toolbox\local\pathdef.m (where $matlabroot is the output of typing 'matlabroot' at the MATLAB prompt), then it means that the 'pathdef.m' which is being used by MATLAB was not updated by the installer and the directory structure of MATLAB-code was changed since the previous version of MATLAB.
(The installer only updates $matlabroot\toolbox\local\pathdef.m on an install of MATLAB)
If you did not create the file that appears as the topmost output or are not concerned about which 'pathdef.m' file is used by MATLAB or you wish to use the latest 'pathdef.m' file updated by the installer then please rename/delete all the 'pathdef.m' files in the output above except $matlabroot\toolbox\local\pathdef.m.
However, if you wish to continue using the same 'pathdef.m' file then please take the following steps:
Update the above 'pathdef.m' file with the latest path information by typing the following at the MATLAB prompt. (Please note that this would delete all the previous path information and replace it with the factory settings. Hence, you might want to back up the old pathdef.m file so that you can use other path information from it at a later period.)
>>restoredefaultpath; savepath;
Note: The warning may be a symptom of a bigger issue. If the pathdef.m file created by the installer isn’t being used, not only will removed directories cause the warnings, but new directories in the new release will not be added to the MATLAB path. This could result in a much bigger issue.
However, if none of the above steps resolve the issue, then it's possible that there exists a 'startup.m' file which is adding these non-existent directories to the path. You can edit the 'startup.m' file by typing the following at the MATLAB prompt and then delete the lines that are adding the directories that appear in the warning message:
>>edit startup.m
If you are explicitly adding directories to your path in startup.m make sure you are doing so recursively by using the GENPATH command as in
*If you are receiving warning regarding an editor path in R2020a or R2020b, please see the following Answer for workarounds:


Show 3 older comments

Sign in to comment.

More Answers (5)

Edgar Colin
Edgar Colin on 6 Aug 2018
I just wanted to share what I experienced. I believe it might help others with similar problems. So I had created a custom file 'myStartFile.m' that would add a directory to my path, 'C:\Users\Username\Documents\Controls'. This file was just intended to start things up for my simulation so it was intended to be a local directory thing.
'myStartFile.m' contained:
at some point I added 'C:\Users\Username\Documents\Controls' using set path on the menu to make it permanent.
In the middle of my development I deleted 'C:\Users\Username\Documents\Controls\' without first removing it from the path manually from the matlab set path window.
I followed the suggestions and analyzed my pathdef.m file and sure enough one of the first lines was
p = [...
I did not want to tinker with editing pathdef.m since I have hundreds of other crucial entries. What I did instead was to go to
and created
Immediately it became highlighted and I could see it on the 'set path' window. I made sure to delete it from the set path window. Then I checked
edit 'pathdef.m'
and the entry had been deleted from there.
That solved the problem

Michael on 9 Jun 2016
I'm still getting the same errors after running solution
restoredefaultpath; savepath;
In mystartup I have:
fprintf(['**Path: ' pathstr ' \n']);
pathstr='/Users/DarthBowles/Dropbox/Academic Work';
Am I missing something crucially simple?
Thanks for any help!
-Michael B.

  1 Comment

Herman on 15 Jul 2016
Try delete the startup.m file or recreate it.
I had the same issue but don't have startup.mat.
The command restoredefaultpath; savepath; did work for me.

Sign in to comment.

Jari on 16 Nov 2018
I also had a problem with similar warning messages after I installed Matlab 2018b. The installation went fine but after that I noticed that no program shortcuts had been created during the installation. So I had to start Matlab by searching for matlab.exe and clicking it. As Matlab started, I got a bunch of warning messages saying
Warning: Name is nonexistent or not a directory: C:\Program Files\MATLAB\R2018b...
First I tried to uninstall and reinstall Matlab but without success. Luckily I found this thread and tried the suggested commands
>>restoredefaultpath; savepath;
which solved the problem.


Sign in to comment.

Alfonso Camaño Liceras
Alfonso Camaño Liceras on 29 May 2020
I am sorry but i can not delete these warning messages
I have reinstalled 2020 a few times with the same problems
Can anyone help me please?


Colin Fraser
Colin Fraser on 2 Jun 2020
I would try doing the following commands first:
rehash toolboxcache
Then, restart MATLAB.
If you are still experiencing this issue, please create a service request below.
-Colin Fraser
Fazal Rehman
Fazal Rehman on 28 Jul 2020
i have problem submiting my assignment the error is
" Warnig : Function warning : name is nonexistent or a directory :/MALAB Driver /./lib/jasonlib "
it does give me the input option to type email and token but after that when i hit enter it says again
Warning: "./lib/jsonlab" not found in path.
"Warning : "./lib" not found in path
plz hepl !

Sign in to comment.


No tags entered yet.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!