matlab (Windows)
Start MATLAB program from Windows system prompt
Description
matlab
starts the MATLAB® program from the Microsoft®
Windows® system prompt. In this topic 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.
To capture the exit code, start MATLAB with the -wait
option.
matlab
starts MATLAB with the specified startup options.option1 ... optionN
Input Arguments
option1 ... optionN
— One or more startup options
strings
One or more startup options, specified as strings corresponding to valid startup options from the following tables.
Display Options
Option | Result |
---|---|
-noFigureWindows | Disable the display of figure windows in MATLAB. |
-nosplash | Do not display the splash screen during startup. |
Set Initial Working Folder
The initial working folder is the current folder when MATLAB starts. For more information, see MATLAB Startup Folder.
Option | Result |
---|---|
| Set the MATLAB folder to Example: |
| Set the MATLAB folder to the value specified by the Initial working folder preference, located in the General Preferences page of the Preferences. |
Debugging Options
Option | Result |
---|---|
| Copy Command Window output, including error log
reports, in to Example:
|
| Enable use of the Java® debugger. The Java debugger uses the default
The port number is
optional. However, to use the Java debugger while running multiple
MATLAB sessions, you must provide a port
number. The |
Execute MATLAB Script or Function
Option | Result |
---|---|
| Execute MATLAB script, statement, or function non-interactively. MATLAB:
Use the
To test
if a session of MATLAB is running in batch mode, call the
Example: |
| Execute the MATLAB
Note To set the initial working folder, use the
Example: Example:
|
Use Single Computational Thread
By default, MATLAB uses the multithreading capabilities of the computer on which it is running.
Option | Result |
---|---|
-singleCompThread | Limit MATLAB to a single computational thread. This option is for numerical computations only. |
Disable Searching Custom Java Class Path
Option | Result |
---|---|
-nouserjavapath | Disable use of
|
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 That Have Specific Requirements.
In a future release, these options will be removed. For more information, see Version History.
Option | Result |
---|---|
-softwareopengl | Force MATLAB to start with software OpenGL libraries. |
-nosoftwareopengl | Disable auto-selection of OpenGL software. |
COM Server Options
Option | Result |
---|---|
| 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 server in the Windows registry. 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 Prompt and select Run as administrator. If that option is not available, contact your system administrator. Alternatively, you can register MATLAB from the MATLAB command prompt. Type: regmatlabserver For
more information, see Register MATLAB as COM Server and
|
| 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.
Option | Result |
---|---|
| Use in a 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 Update or Modify Network License Files.
Option | Result |
---|---|
| Use the License File,
Example:
|
Help Options
Option | Result |
---|---|
-h | Display options without starting MATLAB. |
-help | Same as |
-? | Same as |
Examples
Startup Without Splash Screen
matlab -nosplash
Copy Command Window Output into output.log
File
matlab -logfile output.log
Return Exit Code on Windows
To return an exit status on the command line, start
MATLAB with the -wait
option.
From the operating system prompt, type:
matlab -wait
Tips
To add folders to the MATLAB search path at startup, set the
MATLABPATH
environment variable before running thematlab
command. For more information, see Add Folders to the MATLAB Search Path at Startup.
Version History
R2022a: OpenGL library options will be removed in a future release
In a future release, the -softwareopengl
and
-nosoftwareopengl
options will be removed. It will no longer
be necessary to specify the graphics renderer when these options are removed.
R2019a: -r
option for non-interactive use is not recommended
To start MATLAB non-interactively, use the -batch
option. To start
MATLAB interactively, use the -r
option.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)