Start MATLAB program from Windows system prompt (2024)

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

Display Options

OptionResult
-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.

OptionResult

-sd folder

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

Example: matlab -sd "C:\work"

-useStartupFolderPref

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

OptionResult

-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.

Execute MATLAB Script or Function

OptionResult

-batch statement

Execute MATLAB script, statement, or function non-interactively. MATLAB:

  • Starts without the desktop

  • Does not display the splash screen

  • Executes statement

  • Displays figure windows, unless combined with the -noFigureWindows option

  • Displays user-generated modal dialog boxes, but does not display unprompted modal dialog boxes

  • Disables changes to preferences

  • Disables toolbox caching

  • Logs text to stdout and stderr

  • Exits automatically with exit code 0 if statement executes successfully. Otherwise, MATLAB terminates with a non-zero exit code.

statement is MATLAB code enclosed in double quotation marks. 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.

Use the -batch option in non-interactive scripting or command line workflows. Do not use this option with the -r option.

To test if a session of MATLAB is running in batch mode, call the batchStartupOptionUsed function.

Example: -batch "myscript"

-r statement

Execute the MATLAB statement. Use this option for interactive workflows. Do not use this option with the -batch option.

Note

To set the initial working folder, use the -sd option. For example:

-sd folder

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

Example: -r "myscript"

Use Single Computational Thread

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

OptionResult
-singleCompThread

Limit MATLAB to a single computational thread. This option is for numerical computations only.

Disable Searching Custom Java Class Path

OptionResult
-nouserjavapath

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 That Have Specific Requirements.

In a future release, these options will be removed. For more information, see Version History.

OptionResult
-softwareopengl

Force MATLAB to start with software OpenGL libraries.

-nosoftwareopengl

Disable auto-selection of OpenGL software.

COM Server Options

OptionResult

-automation

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.

-regserver

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 regmatlabserver.

-unregserver

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.

OptionResult

-wait

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.

OptionResult

-c license

Use the License File, license, specified as a string, a semicolon-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 license.lic

Help Options

OptionResult
-h

Display options without starting MATLAB.

-help

Same as -h option.

-?

Same as -h option.

Start MATLAB program from Windows system prompt (2024)

References

Top Articles
Latest Posts
Article information

Author: Twana Towne Ret

Last Updated:

Views: 6417

Rating: 4.3 / 5 (44 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Twana Towne Ret

Birthday: 1994-03-19

Address: Apt. 990 97439 Corwin Motorway, Port Eliseoburgh, NM 99144-2618

Phone: +5958753152963

Job: National Specialist

Hobby: Kayaking, Photography, Skydiving, Embroidery, Leather crafting, Orienteering, Cooking

Introduction: My name is Twana Towne Ret, I am a famous, talented, joyous, perfect, powerful, inquisitive, lovely person who loves writing and wants to share my knowledge and understanding with you.