matlab (Windows)

Start MATLAB program from Windows system prompt


matlab helpOption
matlab -automation
matlab -c licensefile
matlab -jdb portnumber
matlab -logfile filename
matlab -noFigureWindows
matlab -nosoftwareopengl
matlab -nosplash
matlab -nouserjavapath
matlab -r "statement"
matlab -regserver
matlab -sd "startdir"
matlab shieldOption
matlab -singleCompThread
matlab -softwareopengl
matlab -unregserver
matlab -wait

    Note   You can enter more than one of these options in the same matlab command.


matlab starts the MATLAB® program from the Microsoft® Windows® system prompt. (In this document, the term matlab refers to the command you type, and MATLAB refers to the program). Before actually initiating the execution of MATLAB, matlab configures the run-time environment by:

  • Determining the MATLAB root folder.

  • Determining the host machine architecture.

  • Selectively processing command line options with the rest passed to MATLAB.

  • Setting certain MATLAB environment variables.

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

  • By specifying command line options.

  • By setting environment variables before calling the program.

Specifying Options at the Command Line

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 table below. Enter only one helpOption keyword in a matlab statement.

Values for helpOption




Display matlab command usage.


The same as -help.


The same as -help.

matlab -automation starts MATLAB as an automation server. The server window is minimized, and the MATLAB splash screen does not display on startup.

matlab -c licensefile starts MATLAB using the specified license file. The licensefile argument can have the form port@host. This option causes MATLAB to ignore the LM_LICENSE_FILE and MLM_LICENSE_FILE environment variables.

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 filename. This includes all crash reports.

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

matlab -nosoftwareopengl disables auto-selection of software OpenGL® when a graphics driver with known issues is detected. See -softwareopengl option.

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

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

matlab -r "statement" starts MATLAB and executes the specified MATLAB statement. If statement is the name of a MATLAB function or script, do not specify the file extension. Any required file must be on the MATLAB search path or in the startup folder.

matlab -regserver registers MATLAB as a Component Object Model (COM) server.

matlab -sd "startdir" specifies the startup folder for MATLAB (the current folder in MATLAB after startup). The -sd option has been deprecated. For information about alternatives, see MATLAB Startup Folder.

matlab shieldOption provides the specified level of protection of the address space used by MATLAB during startup on Windows 32–bit platforms. It attempts to help ensure the largest contiguous block of memory available after startup, which is useful for processing large data sets. The shieldOption does this by ensuring resources such as DLLs, are loaded into locations that will not fragment the address space. With shieldOption set to a value other than none, address space is protected up to or after the processing of matlabrc. Use higher levels of protection to secure larger initial blocks of contiguous memory, however a higher level might not always provide a larger size block and might cause startup problems. Therefore, start with a lower level of protection, and if successful, try the next higher level. You can use the memory function after startup to see the size of the largest contiguous block of memory; this helps you determine the actual effect of the shieldOption setting you used. If your matlabrc (or startup.m) requires significant memory, a higher level of protection for shieldOption might cause startup to fail; in that event try a lower level. Values for shieldOption can be any one of the keywords shown in the table below.



-shield minimum

This is the default setting. It protects the range 0x50000000 to 0x70000000 during MATLAB startup until just before startup processes matlabrc. It ensures there is at least approximately 500 MB of contiguous memory up to this point.

Start with this, the default value. To use the default, do not specify a shield option upon startup.

If MATLAB fails to start successfully using the default option, -shield minimum, instead use -shield none.

If MATLAB starts successfully with the default value for shieldOption and you want to try to ensure an even larger contiguous block after startup, try using the -shield medium option.

-shield medium

This protects the same range as for minimum, 0x50000000 to 0x70000000, but protects the range until just after startup processes matlabrc. It ensures there is at least approximately 500 MB of contiguous memory up to this point.

If MATLAB fails to start successfully with the -shield medium option, instead use the default option (-shield minimum).

If MATLAB starts successfully with the -shield medium option and you want to try to ensure an even larger contiguous block after startup, try using the -shield maximum option.

-shield maximum

This protects the maximum possible range, which can be up to approximately 1.5 GB, until just after startup processes matlabrc.

If MATLAB fails to start successfully with the -shield maximum option, instead use the -shield medium option.

-shield none

This completely disables address shielding. Use this if MATLAB fails to start successfully with the default (-shield minimum) option.

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

matlab -softwareopengl forces MATLAB to start with software OpenGL libraries. See -nosoftwareopengl option.

matlab -unregserver removes all MATLAB COM server entries from the registry.

matlab -wait MATLAB is started by a separate starter program which normally launches MATLAB and then immediately quits. Using this option tells the starter program not to quit until MATLAB has terminated. This option is useful when you need to process the results from MATLAB in a script. Calling MATLAB with this option blocks the script from continuing until the results are generated.

Setting Environment Variables

You can set the following environment variables before starting MATLAB.

Variable Name



This variable specifies the License File to use. If you use the -c argument to specify the License File it overrides this variable. The value of this variable can be a list of License Files, separated by semi-colons, or port@host entries.

Was this topic helpful?