Documentation

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

matlab (Windows)

Start MATLAB program from Windows system prompt

Syntax

  • matlab
  • matlab option1 ... optionN

Description

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.

  • Determines the host machine architecture, 32-bit or 64-bit.

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

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

Input Arguments

collapse all

option1 ... optionN — One or more startup optionsstrings

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.

Execute MATLAB Script or Function

OptionResult

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

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

Example: -r myscript

Run 32-Bit MATLAB on 64-Bit Platforms

OptionResult
-win32

Run 32-bit MATLAB on 64-bit processors.

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.

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.

Disable Searching Custom Java Class Path

OptionResult
-nouserjavapath

Disable use of javaclasspath.txt and javalibrarypath.txt files. For more information, see java.opts Files.

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 Features with OpenGL Requirements.

OptionResult
-softwareopengl

Force MATLAB to start with software OpenGL libraries.

-nosoftwareopengl

Disable auto-selection of OpenGL software.

COM Automation 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 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. Open this window and exit MATLAB to continue working with MATLAB.

-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 startup script to process the results from MATLAB. Calling MATLAB with this option blocks the script from continuing until the results are generated.

Shield Options

For 32-bit Windows platforms only.

Shield options provide the specified level of protection of the address space used by MATLAB during startup. These options attempt to provide the largest contiguous block of memory available after startup, which is useful for processing large data sets. These options load resources, such as DLLs, into locations without fragmenting the address space. For shield option values 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. Use the MATLAB memory function after startup to see the size of the largest contiguous block of memory. This function helps you determine the actual effect of the setting you used. If your matlabrc.m or startup.m file requires significant memory, a higher level of protection might cause startup to fail. In that event try a lower level.

Enter one of the options shown in the following table.

Option

Description

-shield minimum

Default setting. Protect the range 0x50000000—0x70000000 until startup processes matlabrc. This option ensures that there is at least approximately 500 MB of contiguous memory up to this point.

Start with this option. If MATLAB fails to start successfully, use the -shield none option instead.

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

-shield medium

Protect the same range as -shield minimum until after startup processes matlabrc. This option ensures that there is at least approximately 500 MB of contiguous memory at this point.

If MATLAB fails to start successfully with this option, use -shield minimum instead.

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

-shield maximum

Protect the maximum range, which can be up to approximately 1.5 GB, until startup processes matlabrc.

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

-shield none

Disable address shielding. Use this option if MATLAB fails to start successfully with the -shield minimum option.

Specify License File

For more information, see Understanding License Files in License Management.

OptionResult

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

Help Options

OptionResult
-h

Display startup options without starting MATLAB.

-help

Same as -h option.

-?

Same as -h option.

Examples

Startup Without Splash Screen

matlab -nosplash 

Copy Command Window Output into output.log File

matlab -logfile output.log
Was this topic helpful?