MATLAB Function Reference Previous page   Next Page
matlab (UNIX)

Start MATLAB (UNIX systems)

Syntax

Description

matlab is a Bourne shell script that starts the MATLAB executable. (In this document, matlab refers to this script; MATLAB refers to the application program). Before actually initiating the execution of MATLAB, this script configures the run-time environment by

There are two ways in which you can control the way the matlab script works:

Specifying Options at the Command Line

Options that you can enter at the command line are as follows:

matlab helpOption displays information that matches the specified helpOption argument without starting MATLAB. helpOption can be any one of the keywords shown in the table below. Enter only one helpOption keyword in a matlab command.

Values for helpOption
Option
Description
-help
Display matlab command usage.
-h
The same as -help.
-n
Display all the final values of the environment variables and arguments passed to the MATLAB executable as well as other diagnostic information.
-e
Display all environment variables and their values just prior to exiting. This argument must have been parsed before exiting for anything to be displayed. The last possible exiting point is just before the MATLAB image would have been executed and a status of 0 is returned. If the exit status is not 0 on return, then the variables and values may not be correct.

matlab archOption starts MATLAB and assumes that you are running on the system architecture specified by arch, or using the MATLAB version specified by variant, or both. The values for the archOption argument are shown in the table below. Enter only one of these options in a matlab command.

Values for archOption
Option
Description
-arch
Run MATLAB assuming this architecture rather than the actual architecture of the machine you are using. Replace the term arch with a string representing a recognized system architecture.
v=variant
Execute the version of MATLAB found in the directory bin/$ARCH/variant instead of bin/$ARCH. Replace the term variant with a string representing a MATLAB version.
v=arch/variant
Execute the version of MATLAB found in the directory bin/arch/variant instead of bin/$ARCH. Replace the terms arch and variant with strings representing a specific architecture and MATLAB version.

matlab dispOption starts MATLAB using one of the display options shown in the table below. Enter only one of these options in a matlab command.

Values for dispOption
Option
Description
-display xDisp
Send X commands to X Window Server display xDisp. This supersedes the value of the DISPLAY environment variable.
-nodisplay
Start the Java virtual machine, but do not start the MATLAB desktop. Do not display any X commands, and ignore the DISPLAY environment variable,

matlab modeOption starts MATLAB without its desktop or Java virtual machine components. Enter only one of the options shown below.

Values for modeOption
Option
Description
-nodesktop
Do not start the MATLAB desktop. Use the current window for commands. The Java virtual machine will be started.

matlab mgrOption starts MATLAB in the memory management mode specified by mgrOption. Enter only one of the options shown below.

Values for mgrOption
Option
Description
-memmgr manager
Set environment variable MATLAB_MEM_MGR to manager. The manager argument can have one of the following values:
  • cache -- The default.
  • compact -- This is useful for large models or MATLAB code that uses many structure or object variables. It is not helpful for large arrays. (This option applies only to 32-bit architectures.)
  • debug -- Does memory integrity checking and is useful for debugging memory problems caused by user-created MEX files.
-check_malloc
The same as using '-memmgr debug'.

matlab -c licensefile starts MATLAB using the specified license file. The licensefile argument can have the form port@host or it can be a colon-separated list of license filenames. This option causes the LM_LICENSE_FILE and MLM_LICENSE_FILE environment variables to be ignored.

matlab -r command starts MATLAB and executes the specified MATLAB command.

matlab -logfile filename starts MATLAB and makes a copy of any output to the command window in file log. This includes all crash reports.

matlab -mwvisual visualid starts MATLAB and uses visualid as the default X visual for figure windows. visualid is a hexadecimal number that can be found using xdpyinfo.

matlab -nosplash starts MATLAB but does not display the splash screen during startup.

matlab -timing starts MATLAB and prints a summary of startup time to the command window. This information is also recorded in a timing log, the name of which is printed to the shell window in which MATLAB is started. This option should be used only when working with a Technical Support Representative from The MathWorks, Inc. (This option applies to glnx86 systems only.)

matlab -debug starts MATLAB and displays debugging information that can be useful, especially for X based problems. This option should be used only when working with a Technical Support Representative from The MathWorks, Inc.

matlab -Ddebugger options starts MATLAB in debug mode, using the named debugger (e.g., dbx, gdb, dde, xdb, cvd). A full path can be specified for debugger.

The options argument can include only those options that follow the debugger name in the syntax of the actual debug command. For most debuggers, there is a very limited number of such options. Options that would normally be passed to the MATLAB executable should be used as parameters of a command inside the debugger (like run). They should not be used when running the MATLAB script.

If any other matlab command options are placed before the -Ddebugger argument, they will be handled as if they were part of the options after the -Ddebugger argument and will be treated as illegal options by most debuggers. The MATLAB_DEBUG environment variable is set to the filename part of the debugger argument.

To customize your debugging session, use a startup file. See your debugger documentation for details.

Specifying Options in the MATLAB Startup File

The .matlab7rc.sh shell script contains definitions for a number of variables that the matlab script uses. These variables are defined within the matlab script, but can be redefined in .matlab7rc.sh. When invoked, matlab looks for the first occurrence of .matlab7rc.sh in the current directory, in the home directory ($HOME), and in the $MATLAB/bin directory, where the template version of .matlab7rc.sh is located.

You can edit the template file to redefine information used by the matlab script. If you do not want your changes applied systemwide, copy the edited version of the script to your current or home directory. Ensure that you edit the section that applies to your machine architecture.

The following table lists the variables defined in the.matlab7rc.sh file. See the comments in the .matlab7rc.sh file for more information about these variables.

Variable
Definition and Standard Assignment Behavior 
ARCH

The machine architecture.

The value ARCH passed with the -arch or -arch/ext argument to the script is tried first, then the value of the environment variable MATLAB_ARCH is tried next, and finally it is computed. The first one that gives a valid architecture is used.

AUTOMOUNT_MAP

Path prefix map for automounting.

The value set in .matlab7rc.sh (initially by the installer) is used unless the value differs from that determined by the script, in which case the value in the environment is used.

DISPLAY

The hostname of the X Window display MATLAB uses for output.

The value of Xdisplay passed with the -display argument to the script is used; otherwise, the value in the environment is used. DISPLAY is ignored by MATLAB if the -nodisplay argument is passed.

LD_LIBRARY_PATH

Final Load library path. The name LD_LIBRARY_PATH is platform dependent.

The final value is normally a colon-separated list of four sublists, each of which could be empty. The first sublist is defined in .matlab7rc.sh as LDPATH_PREFIX. The second sublist is computed in the script and includes directories inside the MATLAB root directory and relevant Java directories. The third sublist contains any nonempty value of LD_LIBRARY_PATH from the environment possibly augmented in .matlab7rc.sh. The final sublist is defined in .matlab7rc.sh as LDPATH_SUFFIX.

LM_LICENSE_FILE

The FLEX lm license variable.

The license file value passed with the -c argument to the script is used; otherwise it is the value set in .matlab7rc.sh. In general, the final value is a colon-separated list of license files and/or port@host entries. The shipping .matlab7rc.sh file starts out the value by prepending LM_LICENSE_FILE in the environment to a default license.file.

Later in the MATLAB script if the -c option is not used, the $MATLAB/etc directory is searched for the files that start with license.dat.DEMO. These files are assumed to contain demo licenses and are added automatically to the end of the current list.

MATLAB

The MATLAB root directory.

The default computed by the script is used unless MATLABdefault is reset in .matlab7rc.sh.

Currently MATLABdefault is not reset in the shipping .matlab7rc.sh.

MATLAB_DEBUG

Normally set to the name of the debugger.

The -Ddebugger argument passed to the script sets this variable. Otherwise, a nonempty value in the environment is used.

MATLAB_JAVA

The path to the root of the Java Runtime Environment.

The default set in the script is used unless MATLAB_JAVA is already set. Any nonempty value from .matlab7rc.sh is used first, then any nonempty value from the environment. Currently there is no value set in the shipping .matlab67rc.sh, so that environment alone is used.

MATLAB_MEM_MGR

Turns on MATLAB memory integrity checking.

The -check_malloc argument passed to the script sets this variable to 'debug'. Otherwise, a nonempty value set in .matlab7rc.sh is used, or a nonempty value in the environment is used. If a nonempty value is not found, the variable is not exported to the environment.

MATLABPATH

The MATLAB search path.

The final value is a colon-separated list with the MATLABPATH from the environment prepended to a list of computed defaults.

SHELL

The shell to use when the "!" or unix command is issued in MATLAB.

This is taken from the environment unless SHELL is reset in .matlab7rc.sh. Currently SHELL is not reset in the shipping .matlab7rc.sh. If SHELL is empty or not defined, MATLAB uses /bin/sh internally.

TOOLBOX

Path of the toolbox directory.

A nonempty value in the environment is used first. Otherwise, $MATLAB/toolbox, computed by the script, is used unless TOOLBOX is reset in .matlab7rc.sh. Currently TOOLBOX is not reset in the shipping .matlab7rc.sh.

XAPPLRESDIR

The X application resource directory.

A nonempty value in the environment is used first unless XAPPLRESDIR is reset in .matlab7rc.sh. Otherwise, $MATLAB/X11/app-defaults, computed by the script, is used.

XKEYSYMDB

The X keysym database file.

A nonempty value in the environment is used first unless XKEYSYMDB is reset in .matlab7rc.sh. Otherwise, $MATLAB/X11/app-defaults/XKeysymDB, computed by the script, is used. The matlab script determines the path of the MATLAB root directory as one level up the directory tree from the location of the script. Information in the AUTOMOUNT_MAP variable is used to fix the path so that it is correct to force a mount. This can involve deleting part of the pathname from the front of the MATLAB root path. The MATLAB variable is then used to locate all files within the MATLAB directory tree.

The matlab script determines the path of the MATLAB root directory by looking up the directory tree from the $MATLAB/bin directory (where the matlab script is located). The MATLAB variable is then used to locate all files within the MATLAB directory tree.

You can change the definition of MATLAB if, for example, you want to run a different version of MATLAB or if, for some reason, the path determined by the matlab script is not correct. (This can happen when certain types of automounting schemes are used by your system.)

AUTOMOUNT_MAP is used to modify the MATLAB root directory path. The pathname that is assigned to AUTOMOUNT_MAP is deleted from the front of the MATLAB root path. (It is unlikely that you will need to use this option.)

See Also

mex

Startup Options in the MATLAB Desktop Tools and Development Environment documentation


Previous page  matlabroot matlab (Windows) Next page

© 1994-2005 The MathWorks, Inc.