Directory Commands


Current Directory:

To change the current or working directory, use cd from the command line, or choose the File/Set Path menu item in the GUI, and then set directory in the "Current Directory Window" of the Matlab Path dialog box..

Determine the current directory using the command pwd.

List files in the current directory using the command dir or ls.

Single quotes are used in file and path specification.

One can use or back \ or fore / slashes to designate directory structure.

Path:
The path is the collection of directories that Matlab searches for existing matlab scripts (.m) files.

One can manipulate the path from a dialog box by selecting the File/Set Path menu item in the GUI. Alternately one can use the path, addpath, rmpath matlab commands.


Samples

  cd Z:\151A    % changes the working directory to Z:\151A 
  cd ..         % changes the working directory to the parent of the current directory
  dir           % lists the files in the current directory
  pwd           % prints the current working directory

UCLA Mathematics Department ©2000