Error using cd, Cannot CD

9 Ansichten (letzte 30 Tage)
Peiyao Zhao
Peiyao Zhao am 12 Jul. 2020
Beantwortet: the cyclist am 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

Akzeptierte Antwort

the cyclist
the cyclist am 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.

Weitere Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by