| Desktop Tools and Development Environment | ![]() |
You can define startup options for MATLAB that instruct MATLAB to perform certain operations when you start it. There are two ways to specify startup options for MATLAB:
Using the Startup File for MATLAB, startup.m
At startup, MATLAB automatically executes the master M-file matlabrc.m and, if it exists, startup.m. The file matlabrc.m, which is in the local directory, is reserved for use by The MathWorks, and by the system manager on multiuser systems.
The file startup.m is for you to specify startup options. For example, you can modify the default search path, predefine variables in your workspace, or define Handle Graphics® defaults. Creating a startup.m file with the line
addpath /home/me/mytools cd /home/me/mytools
adds /home/me/mytools to your default search path and makes mytools the current directory upon startup.
Location of startup.m. Place the startup.m file in the current startup directory, which is where MATLAB first looks for it. For more information, see Startup Directory for MATLAB. You can instead place it in $matlabroot/toolbox/local, which is the next place MATLAB looks for startup.m, where $matlabroot is the directory in which MATLAB is installed.
Adding Startup Options for Windows Platforms
You can add selected startup options (also called command flags or command line switches) to the target path for your Windows shortcut for MATLAB. Follow these steps:
matlab.exe opens to the Shortcut pane.
matlab.exe, add /r results to the end of the file path. This instructs MATLAB to run the results file automatically after startup. The statement in the Target field might appear as
The following table lists many of the MATLAB startup options. For a complete list, see the reference page for matlab (Windows).
| Option |
Description |
|---|---|
/automation |
Start MATLAB as an automation server, minimized and without the MATLAB splash screen. For more information, see COM and DDE Support in the External Interfaces documentation. |
|
Set LM_LICENSE_FILE to licensefile. It can have the form port@host. |
/logfile logfilename |
Automatically write output from MATLAB to the specified log file. |
/minimize |
Start MATLAB with the desktop minimized. Any desktop tools or documents that were undocked when MATLAB was last closed will not be minimized upon startup. |
/nosplash |
Start MATLAB without displaying the MATLAB splash screen. |
/r MATLAB_command |
Automatically run the specified MATLAB command or M-file immediately after MATLAB starts. This is also referred to as calling MATLAB in batch mode. Separate multiple commands with commas or semicolons (;). See also Notes About Startup Options. |
/regserver |
Modify the Windows registry with the appropriate COM entries for MATLAB. For more information, see COM and DDE Support in the External Interfaces documentation. |
/unregserver |
Modify the Windows registry to remove the COM entries for MATLAB. Use this option to reset the registry. For more information, see COM and DDE Support in the External Interfaces documentation. |
-) instead of a slash (/), for example, -nosplash.
/r option, all M-files or commands used must be on the MATLAB path or in the MATLAB startup directory. For example
runs myownfile, where myownfile is in the MATLAB startup directory. Use only the filename, not the file extension or pathname. For example, MATLAB produces an error when you run
Adding Startup Options for UNIX Platforms
Include startup options (also called command flags or command line switches) after the matlab startup command.
For example, to start MATLAB without the splash screen, type
matlab -nosplash
For more details, see the matlab reference page.
| Option |
Description |
|---|---|
|
Run MATLAB assuming architecture arch. |
|
Run the version of MATLAB with the extension ext, if it exists, assuming architecture arch. |
|
Set LM_LICENSE_FILE to licensefile. It can have the form port@host. |
|
Set the MATLAB_MEM_MGR environment variable to debug. This starts MATLAB memory integrity checking. |
|
Start MATLAB with the specified debugger. |
|
Turn on MATLAB internal debugging. |
|
Send X commands to Xserver. |
|
Run the version of MATLAB with the extension ext, if it exists. |
|
Display startup options (without starting MATLAB). |
|
Automatically write output from MATLAB to the specified log file. |
|
Specify the default X visual to use for figure windows. |
|
Display final values of environment variables and arguments passed to MATLAB (without starting MATLAB). |
|
Start MATLAB without bringing up the MATLAB desktop. Use this option to run without an X-window, for example, in VT100 mode, or in batch processing mode. Note that if you pipe to MATLAB using the > constructor, the nodesktop option is used automatically.With nodesktop, you can still use most development environment tools by starting them via a function. Specifically use
nodesktop to provide a command line interface. If you prefer a command line interface, select Desktop -> Desktop Layout -> Command Window Only. |
-nodisplay |
MATLAB ignores the display argument. |
|
Start MATLAB without loading the Java VM. This minimizes memory usage and improves initial startup speed. With nojvm, you cannot use the desktop, or any of the tools that require Java. |
|
Start MATLAB without displaying the splash screen during startup. |
- |
Automatically run the specified MATLAB command immediately after MATLAB starts. This is also referred to as calling MATLAB in batch mode. Separate multiple commands with commas or semicolons (;). See also Notes About Startup Options. |
| Startup Directory for MATLAB | Toolbox Path Caching in MATLAB | ![]() |