software:matlab:interactivetips

Interactive Job tips for MATLAB

All MATLAB sessions should be run from the compute nodes.

  • cd – change to your Matlab directory.
  • workgroup – activate your workgroup.
  • Logon to an available compute node by using the appropriate job scheduler command
    • GridEngine qlogin
    • Slurm salloc
  • vpkg_require – Add Matlab and dependencies to your environment.

Once you are successfully connected to a compute node, then you can start MATLAB in command line mode or run scripts.

To start in command line mode (no GUI)
    matlab -nodesktop -nosplash

You will still have access to the help browser (doc command), the editor (edit command), and graphics (plot command for example).

Command Line Matlab with no X11 display

If you do not have an X11 server, or you do not need a display, start MATLAB with

    matlab -nodisplay

The doc command is not available, but you still can use the help command. You can use the edit command, provided you had exported the EDITOR environment variable, For example, to use vim as your editor:

    env EDITOR=vim matlab -nodisplay

You can't display graphics, but you can export graphics to a file.

Execute a MATLAB script

If your have MATLAB commands in a script.m file, then start with the command

    matlab -nodisplay -r script

All the text output from the script will appear on the terminal screen. If this last command in the script.m file is quit or exit you will be returned the bash prompt.

If you have MATLAB commands in a script.m file, start with the command
    nohup matlab -nodisplay -r script &

All the text output from the script will be appended to the file nohup.out. You will be returned immediately to the bash prompt while the script runs in the background. If you exit or logout the interactive terminal session the MATLAB job will continue to execute, writing output to nohup.out and exporting graphics to files.

You should not read from the terminal in your script. Without the nuhup, MATLAB may respond to any hangup signal from your terminal shell by stopping execution. Reading input from the terminal may cause your MATLAB job to stay loaded, waiting for input.

  • software/matlab/interactivetips.txt
  • Last modified: 2019-08-29 14:31
  • by anita