Can anyone solve this error

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)

Risposte (2)

Star Strider
Star Strider il 23 Nov 2019

0 voti

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 Commenti

Thank you,
I gott my answer for 'cd'
Star Strider
Star Strider il 23 Nov 2019
My pleasure.

Accedi per commentare.

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.

Categorie

Richiesto:

il 23 Nov 2019

Commentato:

il 23 Nov 2019

Community Treasure Hunt

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

Start Hunting!

Translated by