From BrainImagingCenter
Revision as of 15:34, 9 January 2008 by Jed.dobson (Talk | contribs) (Using Matlab 7)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Using Matlab 6.5

All uses are pre-configured for Matlab (R13). This is the default on both Solaris and Intel/AMD64 computers.

Using Matlab 7

The default version of Matlab 7 is (R2007a) running in 64bit mode. If you want to use the 32-bit mode you can run matlab32 to x86 and AMD64 computers only. The Solaris systems can only use the 64-bit version.

[jed@dexter ~]$ matlab7
Note: Running 64bit Matlab7
Warning: Unable to open display , MATLAB is starting without a display.
  You will not be able to display graphics on the screen.
Warning: No window system found.  Java option 'MWT' ignored

                              < M A T L A B >
                  Copyright 1984-2007 The MathWorks, Inc.
                         Version (R2007a)
                              January 29, 2007

  To get started, type one of these: helpwin, helpdesk, or demo.
  For product information, visit

Matlab Editor Environment

The default editor for Matlab is emacs. If you prefer to use another editor such as vi or nedit you can modify your own EDITOR shell environment variable. This variable is set at login time through the DBIC shell initialization scripts to emacs. Changing your own profile will override this default. In addition you can also modify the variable for a single session from the shell.

[jed@eros ~]$ echo $EDITOR
[jed@eros ~]$ export EDITOR=nedit
[jed@eros ~]$ matlab

                                   < M A T L A B >
                       Copyright 1984-2002 The MathWorks, Inc.
                          Version Release 13
                                     Jun 18 2002

  To get started, type one of these: helpwin, helpdesk, or demo.
  For product information, visit
>> edit foo.m
nedit: the current locale is utf8 (en_US.UTF-8)
nedit: changed locale to non-utf8 (en_US)

To make this your default open ~/.profile and insert the following line:

EDITOR=nedit; export EDITOR

startup.m and mystartup.m

Your ~/matlab/startup.m file should be a read-only link to a system-wide default. Your user-specific changes go into ~/matlab/mystartup.m.

If you wish to have a local directory added to your Matlab path the following line inserted into ~/matlab/mystartup.m will enable it be added on each invocation of the Matlab application:


In the case that you do not have a mystartup.m you can just create a new one and add to your required commands. To replace a removed ~/matlab/startup.m you should run "switch" with your desired version of SPM as an argument (i.e, switch spm2).

Changing SPM Version

The shell script "switch" will reconfigure your environment for SPM99, SPM2, or SPM5. Your ~/matlab/startup.m file will be linked to the system-wide version for the requested SPM environment.

To find your current version use the "query" argument for switch:

[jed@dexter ~]$ switch query
You are currently running SPM2

Changing from SPM2 to SPM5 and confirming results with ls:

[jed@dexter ~]$ switch spm5
adjusting paths for SPM5
You can now invoke matlab and use spm5
[jed@dexter ~]$ ls -l ~/matlab/startup.m
lrwxr-xr-x  1 jed users 75 Jan  8 19:22 /afs/ ->