Desktop Tools and Development Environment Previous page   Next Page

Startup Options

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:

  1. Right-click the MATLAB shortcut icon.

    Image of MATLAB shortcut icon, used for adding startup options.

  1. and select Properties from the context menu. The Properties dialog box for matlab.exe opens to the Shortcut pane.

  1. In the Target field, after the target path for 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
  2. Click OK.

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.
/c licensefile
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.

Notes About Startup Options.   

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  
-arch
Run MATLAB assuming architecture arch.
-arch/ext
Run the version of MATLAB with the extension ext, if it exists, assuming architecture arch.
-c licensefile
Set LM_LICENSE_FILE to licensefile. It can have the form port@host.
-check_malloc
Set the MATLAB_MEM_MGR environment variable to debug. This starts MATLAB memory integrity checking.
-Ddebugger [options]
Start MATLAB with the specified debugger.
-debug
Turn on MATLAB internal debugging.
-display Xserver
Send X commands to Xserver.
-ext
Run the version of MATLAB with the extension ext, if it exists.
-h or -help
Display startup options (without starting MATLAB).
-logfile log
Automatically write output from MATLAB to the specified log file.
-mwvisual visualid
Specify the default X visual to use for figure windows.
-n
Display final values of environment variables and arguments passed to MATLAB (without starting MATLAB).
-nodesktop
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
Don't 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.
-nojvm
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.
-nosplash
Start MATLAB without displaying the splash screen during startup.
-r MATLAB_command
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.


Previous page  Startup Directory for MATLAB Toolbox Path Caching in MATLAB Next page