Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

(star) MATLAB startup file: when started, MATLAB will run a script if it finds a file called "startup.m". This is useful for automatically starting SPM, including various versions. In ~2012 and earlier versions, this script was located in C:\Program Files\MATLAB\R2012a\toolbox\local. However, in later versions, this file defaults to users' local folders (in Documents\MATLAB). The advantage of this location is that when MATLAB is upgraded, the startup file does not need to be copied. This option is best for computers with mostly one person logging on.

Example:

Code Block
languagematlab
% Starts SPM

% Assume SPM is in the following folder
cd c:\matlab\spm12

% SPM requires the base folder to be added to the path
addpath(pwd)

% Start with fMRI option (the usual one)
spm fmri

If more than on person uses the computer, the startup file would need to be copied to each user's documents\MATLAB folder, so it may be simpler to place the file in the original, release-specific subfolder. To have MATLAB run the same script for all users:

...