Skip to main content
Logo image

Section 5.7 Current Directory

We previously learned all about directory structures and paths (relative and absolute). When you start MATLAB, the current directory is set to a default directory or the directory from which you started. When you run script files, the file must either be in the current directory or in the search path. It is possible to change both.
Window showing the current directory in MATLAB
Figure 5.2. Current directory in MATLAB
One can modify the current directory just like selecting files, or one can use the cd command, like in Linux:
>> cd('directory');   %relative or absolute
Window showing the current directory in MATLAB
Figure 5.3. Current directory in MATLAB