trying to use the dir / cd(dir) function, "error using cd. unable to change current folder to...(name is nonexistent or not a folder)" message appears
Ältere Kommentare anzeigen
Hi
I am working on an assignment and the first question asks to define the directory. The function I am having trouble with is dir and cd(dir). I am using the live editor function on the online version of Matlab. After following the instructions provided to me from my prof, I end up with this message ""error using cd. unable to change current folder to '/MATLAB Drive/C: \Users\X\Documents\school\Labdata.xlsx'. (name is nonexistent or not a folder). X is just my name. My code is this:
dir = 'C: \Users\X\Documents\school\Labdata.xlsx' ;
cd(dir)
Can someone please explain why I am having this issue and how I can resolve it? Thank you in advance!
1 Kommentar
dir = 'C: \Users\X\Documents\school\Labdata.xlsx' ;
% ^ invalid path name
% ^^^^^^^^^^^^ cannot CD to a file
%^^ variable name is best avoided
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu File Operations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!