Cornell University Cornell University CISER

CISER Computing

Running Matlab Jobs in Batch Mode

General Instructions for Running a Matlab Job in Batch Mode in Windows.

Example: Running a Matlab job in batch mode on a CISER Research Computing node.

  • Use the Matlab M-file editor (or other text editor) to create your ".m" file:
    • Be sure that the filename extension is .m.
    • Be sure to include the command "exit" as the last command in the file.
  • Open a command window on the CISER computing node desktop:
    • From Windows go to Start --> Run --> and type in "Command" --> OK.
    • OR go to Start --> All Programs --> Accessories --> Command Prompt.
  • In the command window change to the directory which contains your ".m" file:
    • First change to the U: drive by typing U: at the prompt and then press "enter".
    • Then change directories to the folder you wish to use:
      • examples:
        • cd User2\cam6
        • cd User1\cam6\My Documents\mymfiles
    • Run the matlab job from the command line as follows:
      • type at the prompt:
        • matlab   -nosplash   -r   [a,b,c]=myarray   -logfile   myarray.log
        • Where "myarray"  refers to the .m file ("myarray.m") in the current working directory, and "myarray.log" is the log file that will contain the output that would usually be generated in the Matlab window if run in interactive mode.