cd newFolder changes the current folder to
newFolder. Folder changes are global. Therefore, if you use
cd within a function, the folder change persists after
MATLAB® finishes executing the function.
Change the current folder to the featured examples folder for MATLAB R2017a, assuming that version is installed on your C: drive. Then restore the current folder to its original location.
Change the current folder to the featured examples folder for MATLAB R2017a.
cd 'C:\Program Files\MATLAB\R2017a\examples\matlab_featured'
Change the current folder to C:\Program Files, saving the folder path before changing it.
Change the current folder to the featured examples folder for MATLAB R2016b, assuming that version is installed in your user home folder on a UNIX platform.
New folder path to which you want to change the current folder, specified
as a character vector or string scalar. If newFolder is a
string, enclose it in parentheses. For example,
cd("FolderName").
Valid values include a full or relative path or one of these
values.
../
One level up from the current folder.
Multiples of ../
Multiple levels up from the current folder.
./
A path relative to the current folder.
cd assumes that the path is
relative to the current folder even if the
./ is not present.
If newFolder contains spaces, enclose it in single
quotation marks. For example, cd 'Folder Name'.
On UNIX® systems, you can use the ~ (tilde) character to represent the
user home folder. For example, ~/ or
~username/.
MATLAB resolves folder path names containing '.',
'..', and symbolic links to their
target location before changing the current folder. For example, if you
specify c:\matlab\..\work, MATLAB resolves the path name to c:\work before
changing the current folder.
The current folder is a reference location
that MATLAB uses to find files. This folder is sometimes referred
to as the current directory, current
working folder, or present working directory.
On Windows machines, leading whitespace characters in the input path are no longer
trimmed. Input paths containing leading whitespace characters cause an error to be
thrown instead.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.