In MATLAB, cd
is a command that is used to change the current working directory of the MATLAB's current session/session folder. In other words, it is used to navigate between different directories/folders in the user's file system.
The basic syntax of cd
command is:
main.m14 chars2 lines
Here, foldername
represents the name of the folder you want to navigate to.
For example, if you want to navigate to the folder called myfolder
which is located in C drive in your computer, you can use the following command:
main.m17 chars2 lines
Note that the folder name should be enclosed in quotes if it contains any spaces between words. Otherwise, you can simply enter the folder name without quotes.
Once you execute this command, the current directory will change to C:\myfolder
. You can check if the command is successfully executed by using the pwd
command which returns the present working directory (current directory).
main.m25 chars4 lines
You can also use the cd command without any inputs to navigate to the user's home directory.
main.m3 chars2 lines
This will take you back to the home directory, which is the directory in which MATLAB was executed.
gistlibby LogSnag