Documentation Center

  • Trials
  • Product Updates

matlab (UNIX)

Start MATLAB program (UNIX platforms)


matlab helpOption
matlab envDispOption
matlab archOption
matlab dispOption
matlab modeOption
matlab -c licensefile
matlab -debug
matlab -Ddebugger options
matlab -jdb portnumber
matlab -logfile filename
matlab -mwvisual visualid
matlab -noFigureWindows
matlab -nosplash
matlab -nouserjavapath
matlab -r "command"
matlab -singleCompThread

    Note   You can enter more than one of these options in the same matlab command. If you use -Ddebugger to start MATLAB® in debug mode, the first option in the command must be -Ddebugger.


matlab is a Bourne shell script that starts the MATLAB executable on UNIX® platforms. (In this document, matlab refers to this script; MATLAB refers to the application program). Before actually initiating the execution of MATLAB, this script configures the run-time environment by:

  • Determining the MATLAB root folder

  • Determining the host machine architecture

  • Processing any command-line options

  • Reading the MATLAB startup file,

  • Setting MATLAB environment variables

There are two ways in which you can control the way the matlab script works:

  • By specifying command-line options

  • By assigning values in the MATLAB startup file,

Specifying Options at the Command Line

    Note:   On Apple Macintosh platforms, the matlab script is located inside the MATLAB application package:


    To run the matlab script from Terminal, specify the full path, or cd to the bin folder within the application package and preface the command with ./ characters. For example:

    ./matlab -nojvm -nodisplay -nosplash -r "myfun(10,30)"

Options that you can enter at the command line are as follows:

matlab helpOption displays information that matches the specified helpOption argument without starting MATLAB. helpOption can be any one of the keywords shown in the following table. Enter only one helpOption keyword in a matlab command.

 Values for helpOption

matlab envDispOption displays the values of environment variables passed to MATLAB or their values when exiting MATLAB. envDispOption can be either one of the options shown in the following table.

 Values for envDispOption

matlab archOption starts MATLAB and assumes that you are running on the system architecture specified by arch, or using the MATLAB version specified by variant, or both. The values for the archOption argument are shown in the following table. Enter only one of these options in a matlab command.

 Values for archOption

matlab dispOption starts MATLAB using one of the display options shown in the following table. Enter only one of these options in a matlab command.

 Values for dispOption

matlab modeOption starts MATLAB without its usual desktop component. Enter only one of the options shown in the following table.

 Values for modeOption

matlab -c licensefile starts MATLAB using the specified license file. The licensefile argument can have the form port@host or it can be a colon-separated list of license filenames. This option causes the LM_LICENSE_FILE and MLM_LICENSE_FILE environment variables to be ignored.

matlab -debug starts MATLAB and displays debugging information that can be useful, especially for X based problems. Use this option only when working with a Technical Support Representative from The MathWorks, Inc.

matlab -Ddebugger options starts MATLAB in debug mode, using the named debugger (for example, dbx, gdb, xdb, cvd, lldb). A full path can be specified for debugger.

 Notes for -Ddebugger Argument

matlab -jdb portnumber starts MATLAB, enabling use of the Java debugger. If you specify a port number, the Java debugger uses that port to communicate with MATLAB. You can specify any port number in the range 0-65535 that is not reserved or currently in use by another application on your system. By default, MATLAB uses port 4444. If you are running multiple MATLAB sessions and want to use the Java debugger, be sure to specify a port number.

matlab -logfile filename starts MATLAB and makes a copy of any output to the Command Window in file log. The output includes all crash reports.

matlab -mwvisual visualid starts MATLAB and uses visualid as the default X visual for figure windows. visualid is a hexadecimal number that can be found using xdpyinfo.

matlab -noFigureWindows starts MATLAB, but disables the display of any figure windows in MATLAB.

matlab -nosplash starts MATLAB but does not display the splash screen during startup.

matlab -nouserjavapath disables javaclasspath.txt and javalibrarypath.txt files.

matlab -r "command" starts MATLAB and executes the specified MATLAB command. Include the command in double quotation marks ("command"). If command is the name of a MATLAB function or script, do not specify the file extension. To separate multiple statements, use semicolons or commas.

matlab -singleCompThread limits MATLAB to a single computational thread. By default, MATLAB uses the multithreading capabilities of the computer on which it is running.

Specifying Options in the MATLAB Startup File

The shell script contains definitions for a number of variables that the matlab script uses. These variables are defined within the matlab script, but can be redefined in When invoked, matlab looks for the first occurrence of in the current folder, in the home folder ($HOME), and in the matlabroot/bin folder, where the template version of is located.

You can edit the template file to redefine information used by the matlab script. If you do not want your changes applied system-wide, copy the edited version of the script to your current or home folder. Ensure that you edit the section that applies to your machine architecture.

The following table lists the variables defined in file. See the comments in the file for more information about these variables.

 Variable Options for Startup File

The matlab script determines the path of the MATLAB root folder by looking up the folder tree from the matlabroot/bin folder (where the matlab script is located). The MATLAB variable is then used to locate all files within the MATLAB folder tree.

You can change the definition of MATLAB if, for example, you want to run a different version of MATLAB or if, for some reason, the path determined by the matlab script is not correct. (This can happen when your system uses certain types of automounting schemes.)

See Also


Was this topic helpful?