Start MATLAB program from Windows system prompt
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
option1 ... optionN
— One or more startup optionsOne or more startup options, specified as strings corresponding to valid startup options from the following tables.
Option | Result |
---|---|
-noFigureWindows | Disable the display of figure windows in MATLAB. |
-nosplash | Do not display the splash screen during startup. |
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 option in the General Preferences panel. |
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 |
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:
|
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. |
Option | Result |
---|---|
-nouserjavapath | Disable use of
|
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.
Option | Result |
---|---|
-softwareopengl | Force MATLAB to start with software OpenGL libraries. |
-nosoftwareopengl | Disable auto-selection of OpenGL software. |
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. |
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. |
For more information, see Network License Files.
Option | Result |
---|---|
| Use the License File,
Example:
|
Option | Result |
---|---|
-h | Display options without starting MATLAB. |
-help | Same as |
-? | Same as |
matlab -nosplash
output.log
Filematlab -logfile output.log
To return an exit status on the command line, start
MATLAB with the -wait
option.
From the operating system prompt, type:
matlab -wait
To add folders to the MATLAB search path at startup, set the MATLABPATH
environment variable before running the matlab
command. For
more information, see Add Folders to the MATLAB Search Path at Startup.
-r
option for non-interactive use is not recommendedNot recommended starting in R2019a
To start MATLAB non-interactively, use the -batch
option. To start
MATLAB interactively, use the -r
option.