This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

matlab (Windows)

Start MATLAB program from Windows system prompt


matlab option1 ... optionN


matlab starts the MATLAB® program from the Microsoft® Windows® system prompt. Here the term matlab refers to the command you type, and MATLAB refers to the program).

The matlab command:

  • Determines the MATLAB root folder, the value returned by the matlabroot function.

  • Processes command-line options and passes other options to MATLAB.


matlab option1 ... optionN starts MATLAB with the specified startup options.

Input Arguments

expand all

One or more startup options, specified as strings corresponding to valid startup options from the following tables.

Display Options


Disable the display of figure windows in MATLAB.


Do not display the splash screen during startup.

Execute MATLAB Script or Function


-r statement

Execute the MATLAB statement, specified as a string or as the name of a MATLAB script or function. If statement is MATLAB code, enclose the string in double quotation marks. If statement is the name of a MATLAB function or script, do not specify the file extension and do not use quotation marks. Any required file must be on the MATLAB search path or in the startup folder.


To set the initial working folder to folder, type:

-sd folder

Example: -r "disp(['Current folder: ' pwd])"

Example: -r myscript

Set Initial Working Folder

The initial working folder is the current folder when MATLAB starts. For more information, see MATLAB Startup Folder.


-sd folder

Set the MATLAB startup folder to folder, specified as a string.

Example: matlab -sd "C:\work"


Set the MATLAB startup folder to the value specified by the Initial working folder option in the General Preferences panel.

Debugging Options


-logfile filename

Copy Command Window output, including error log reports, in to filename, specified as a string.

Example: -logfile output.log

-jdb portnumber

Enable use of the Java® debugger. The Java debugger uses the default portnumber value 4444 to communicate with MATLAB.

The port number is optional. However, to use the Java debugger while running multiple MATLAB sessions, you must provide a port number. The portnumber value must be an integer in the range 0–65535. The integer cannot be reserved or currently in use by another application on your system.

Use Single Computational Thread

By default, MATLAB uses the multithreading capabilities of the computer on which it is running.


Limit MATLAB to a single computational thread.

Disable Searching Custom Java Class Path


Disable use of javaclasspath.txt and javalibrarypath.txt files. For more information, see Specifying Java Startup Options.

OpenGL Library Options

These options control the use of software OpenGL® libraries when MATLAB detects a graphics driver with known issues. For more information, see Graphics Features with OpenGL Requirements.


Force MATLAB to start with software OpenGL libraries.


Disable auto-selection of OpenGL software.

COM Automation Server Options



Start MATLAB as a Component Object Model (COM) Automation server. MATLAB does not display the splash screen and minimizes the window. Use for a single call to MATLAB.


Register MATLAB as a COM Automation server in the Windows registry. MATLAB displays a minimized command window; close this window.

You must have administrator privileges to change the Windows registry. Based on your User Account Control (UAC) settings, you might need to right-click a Windows Command Processor and select Run as administrator. If that option is not available, contact your system administrator.

MATLAB remains registered until you use the -unregserver option.

Alternatively, you can register MATLAB from the MATLAB command prompt. Type:

!matlab -regserver
MATLAB displays a minimized command window. To continue working with MATLAB, open this window and exit MATLAB.


Remove MATLAB COM server entries from the registry.

Wait for MATLAB to Terminate

By default, when you call the matlab command from a script, the command starts MATLAB and then immediately executes the next statements in the script. The -wait option pauses the script until MATLAB terminates.



Use in a startup script to process the results from MATLAB. Calling MATLAB with this option blocks the script from continuing until the results are generated.

Specify License File

For more information, see Understanding Network License Files (Installation, Licensing, and Activation).


-c license

Use the License File, license, specified as a string, a colon-separated list of license file names, or a port@host entry. If specifying multiple files, separate the names by semicolons and enclose the entire list in quotation marks. If the path to your license file contains a space, enclose the path name in quotation marks.

Example: -c "c:\TMW license\license_agreement.txt"

Open Student Version



Open student version of MATLAB.

Help Options


Display startup options without starting MATLAB.


Same as -h option.


Same as -h option.


expand all

matlab -nosplash 
matlab -logfile output.log