Starting MATLAB
1-5
Startup Options
You can define startup options for MATLAB, which instruct MATLAB to
perform certain operations upon startup. There are two ways to specify startup
options for MATLAB:
• “Using the Startup File for MATLAB, startup.m” on page 1-5
• “Adding Startup Options for Windows Platforms” on page 1-5 or “Adding
Startup Options for UNIX Platforms” on page 1-7
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 lives in the
local
directory, is reserved for use by The MathWorks, and on multiuser systems, by
your system manager.
The file
startup.m
is for you to use to specify startup options. You can modify
the default search path, predefine variables in your workspace, or define
Handle Graphics
defaults. For example, creating a
startup.m
file with the
1
Right-click on the MATLAB shortcut icon and select
Properties
from the
context menu.
The
Properties
dialog box for
matlab.exe
opens to the
Shortcut
panel.
2
In the
Target
field, after the target path for
matlab.exe
, add one or more of
the allowable startup options listed here.
Option Description
/automation
Start MATLAB as an automation server,
minimized and without the MATLAB splash
screen. For more information, see “Client/Server
Applications” in the External Interfaces Guide.
/c licensefile
Set
LM_LICENSE_FILE
to
licensefile
3
Click
OK
.
Example – Setting the Startup Options to Automatically Run an M-File.
To start
MATLAB and automatically run the file
results.m
, use this target path for
your Windows shortcut.
D:\matlabr12\bin\win32\matlab.exe /r results
Startup Options If You Run MATLAB from a DOS Window.
If you run MATLAB from a
DOS window, include the startup options listed in the preceding table after the
matlab
startup function.
For example, to start MATLAB and automatically run the file
results.m
, type
matlab /r results
Adding Startup Options for UNIX Platforms
Include startup options (also called command flags) after the
matlab
startup
function. The startup options for UNIX are listed in the following table
Option Description
-arch
Run MATLAB assuming architecture
arch
.
-h
or
-help
Displays startup options.
1
Starting and Quitting MATLAB
1-8
-mwvisual visualid
Specify the default X visual to use for figure
windows.
-n
Print environment variables only.
-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 with a function. Specifically use:
•
edit
For example, to start MATLAB without the splash screen, type
matlab -nosplash
-nojvm
Start MATLAB without loading the Java VM.
This minimizes memory usage and improves
initial startup speed. With
nojvm
, you cannot
use the desktop, nor any of the tools that
require Java. The restrictions are the same as
those described under UNIX Platform
Limitations in the R12 Release Notes.
-nosplash
Start MATLAB without displaying the splash
screen during startup.
Option Description (Continued)
1
Starting and Quitting MATLAB
1-10
Reducing Startup Time with Toolbox Path Caching
If you run MATLAB from a network server, you can significantly reduce your
startup time by using the MATLAB toolbox path cache. The toolbox path cache
stores search path information on all toolbox directories under the MATLAB
root directory. During startup, MATLAB obtains this information from the
cache rather than by reading it from the remote file system.
The toolbox path cache is used only during the startup of your MATLAB
session. It is especially useful if you define your MATLAB search path to
include many toolbox directories. It takes considerable time to acquire all of
this information by scanning directories in the remote file system. Reading it
from a pre-generated cache however, is significantly faster. If you have a short
under
Toolbox caching
.
With
Enable toolbox cache
selected, MATLAB displays summary
information during startup, sends notification when it loads the toolbox
directories from the cache, and displays a warning if the toolbox path cache
cannot be found.
1
Starting and Quitting MATLAB
1-12
4
For additional information, select
Enable toolbox cache diagnostics
.
With
Enable toolbox cache
diagnostics
selected, MATLAB displays
additional information at startup.
MATLAB also provides warnings whenever a toolbox directory is added to
the path from the remote file system at startup rather than from the cache.
This occurs if the cache has not been kept up to date with changes in the
toolbox directories.
5
To generate a new copy of the cache, select
Update Toolbox Cache
. See
“Generating the Toolbox Path Cache” on page 1-12.