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
显示 更早的评论
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 个评论
dir = 'C: \Users\X\Documents\school\Labdata.xlsx' ;
% ^ invalid path name
% ^^^^^^^^^^^^ cannot CD to a file
%^^ variable name is best avoided
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!