라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.
## Specify Startup
Options

### Startup Options from Operating System Prompt

### Startup Options in Shortcut on Windows Systems

### Startup Options in MATLAB Startup File

### Passing Perl Variables on Startup

### Startup and Calling Java Software from MATLAB

## See Also

## More About

You can specify startup options (also called command flags or
command-line switches) that instruct the MATLAB^{®} program to perform
certain operations when you start it. On all platforms, specify the
options as arguments to the `matlab`

command when
you start at the operating system prompt. For example, the following
starts MATLAB and suppresses the display of the splash screen.

matlab -nosplash

On Windows^{®} platforms, you can precede a startup option
with either a hyphen (`-`

) or a slash (`/`

).
For example, `-nosplash`

and `/nosplash`

are
equivalent.

You can add selected startup options (also called command flags or switches for the command line) to the target path for your shortcut on the Windows platform for MATLAB.

To use startup options for the MATLAB shortcut icon on a Windows platform, follow these steps:

Right-click the shortcut icon for MATLAB and select

**Properties**from the context menu. The Properties dialog box for MATLAB opens to the**Shortcut**pane.In the

**Target**field, after the target path for`"matlab.exe"`

, add the startup option, and click**OK**.

This example runs the MATLAB `results`

script
or function after startup, where `results.m`

is in
the startup folder or on the MATLAB search path. The text in
the **Target** field is similar to the following:

"C:\Program Files\MATLAB\R2010b\bin\matlab.exe" -r "results"

Include the statement, but not the option (`-r`

)
in double quotation marks.

Use semicolons or commas to separate multiple statements. This
example changes the format to `short`

, and then runs
the MATLAB code file `results`

:

"... matlab.exe" -r "format('short');results"

Separate multiple options with spaces. This example starts MATLAB without
displaying the splash screen, and then runs the MATLAB code file `results`

:

"... matlab.exe" -nosplash -r "results"

The `startup.m`

file is a file you create to
specify startup options. Create the `startup.m`

file
in a folder on the MATLAB search path. Use `startup.m`

to
modify the default search path, predefine variables in your workspace,
or define defaults for graphics objects. For example, the following
statement adds the user-defined folder `/home/myname/mytools`

to
the search path.

addpath /home/myname/mytools

To change the current folder on startup to `mytools`

,
set the **Initial working folder** value, described
in General Preferences,
to:

/home/myname/mytools

At startup, MATLAB automatically executes the file `matlabrc.m`

and,
if it exists on the MATLAB search path, `startup.m`

.
The file `matlabrc.m`

, which is in the `matlabroot`

`/toolbox/local`

folder,
is reserved for use by MathWorks^{®} and by system administrators
on multiuser systems.
To locate the `startup.m`

file, type:

`which startup`

If MATLAB finds a `startup.m`

file, it
displays the path to the file.

You can pass Perl variables to MATLAB on startup by using the `-r`

option
of the `matlab`

function. For example, assume a MATLAB function `test`

that
takes one input variable:

function test(x)

To pass a Perl variable instead of a constant as the input parameter,
follow these steps. This command starts MATLAB and runs `test`

with
the input argument `10`

.

Create a Perl script such as

#!/usr/local/bin/perl $val = 10; system('matlab -r "test(' . ${val} . ')"');

Invoke the Perl script at the prompt using a Perl interpreter.

For more information, see the `-r`

option
in `matlab (Windows)`

, `matlab (Mac)`

, or ```
matlab
(Linux)
```

.

When MATLAB starts, it constructs the class path for Java^{®} software
using `javaclasspath.txt`

and `javalibrarypath.txt`

files.
For more information, see Java Class Path and Locating Native Method Libraries.

For information about memory allocation for Java objects, see Java Heap Memory Preferences.

`matlab (Linux)`

| `matlab (Mac)`

| `matlab (Windows)`

Was this topic helpful?