MATLAB Answers

Error using cd, Cannot CD

8 views (last 30 days)
Peiyao Zhao
Peiyao Zhao on 12 Jul 2020
Answered: the cyclist on 12 Jul 2020
When I tried to run the following code in my matlab, it said" Error using cd, Cannot CD to( Name is nonexistent or not a directory), could you tell me why this happens, thank you very much!
if(~isdeployed)
cd(fileparts(which(mfilename)));
end

  0 Comments

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 12 Jul 2020
This code works for me when mfilename is a file that exists in my path, but otherwise it gives that error. So, my guess is that you have an error in what is stored in mfilename.

  0 Comments

Sign in to comment.

More Answers (0)


Translated by