Can anyone solve this error

1 回表示 (過去 30 日間)
Neel Shah
Neel Shah 2019 年 11 月 23 日
コメント済み: Star Strider 2019 年 11 月 23 日
I am running the following code :-
cd E
clc,disp('Hello Neel\n Work hard and Learn More.')
beep off
addpath('C:\Users\USER\Documents\MATLAB\nth')
set(0,'DefaultFigureWindowsStyle','docked')
set(0,'DefaultFigureColormap',jet)
close all
And there is an error in "cd E' and 'Set command'
Following is the error shown in the command window
Error using cd
Cannot CD to E (Name is nonexistent or not a directory).
Error in startup (line 1)
cd E
Can anyone find out the error in the code??
Version:-
MATLAB Version: 8.1.0.604 (R2013a)

回答 (2 件)

Star Strider
Star Strider 2019 年 11 月 23 日
The documentation for the cd function, and the error your code threw, should tell you everything you need to know about it.
I have no idea what you want to do, however the fullfile function is likely a much better alternative than cd.
  2 件のコメント
Neel Shah
Neel Shah 2019 年 11 月 23 日
Thank you,
I gott my answer for 'cd'
Star Strider
Star Strider 2019 年 11 月 23 日
My pleasure.

サインインしてコメントする。


Walter Roberson
Walter Roberson 2019 年 11 月 23 日
cd E
That would be an error if there is no subdirectory named E in your current directory.
Note that if you wanted to switch to drive E then you should use
cd('E:')
or better yet, provide a complete path, because when you CD to use a drive letter, CD returns to the last directory that was used for that drive (there is one current directory per drive.)
set(0,'DefaultFigureWindowsStyle','docked')
Correct is
set(0,'DefaultFigureWindowStyle','docked')
Note that this requires a somewhat recent version of MATLAB.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by