When MATLAB starts, it will look for a file "startup.m" and run it. This file runs a few commands. For example, it might move to the SPM folder, add that folder to the path, and start SPM:
>> cd c:\matlab\spm12
>> addpath c:\matlab\spm12
>> spm fmri
Location of startup file
To see the location of the startup file, if it exists:
There are two locations it looks for this file: in more recent versions of MATLAB, it will look in C:\Users\[...]\Documents\MATLAB. This is the preferred place to haev the startup file. Another legacy location is in the MATLAB program files folder C:\Program FIles\MATLAB\[release]\toolbox\local.
Editing the startup file
To edit the startup file, open it in the MATLAB editor:
If you are having problems at the start, like this
you will need to edit the file.
Troubleshooting
Example 1
The option was to run SPM12, but the error is "Undefined function 'spm'. This means that MATLAB did not see the SPM12 folder. This is mostly likely because the startup file goes to an incorrect location. For example, if the startup file includes
cd c:\matlab\spm12
but M the matlab files are on D:\matlab, then the above error would occur.
0 Comments