Dear Kiyotaka,
this can indeed be a useful script for beginners, and would nicely
complement those:
http://www.nemotos.net/?p=144
http://www.fil.ion.ucl.ac.uk/spm/software/spm8/spm_update.m
Adding a final call to spm_check_installation('basic') or
spm_check_installation('full') might also help diagnose an installation
problem.
This is typically a function that could be advertised somewhere on the
SPM wiki:
http://en.wikibooks.org/wiki/SPM#Installation
Many thanks,
Guillaume.
Kiyotaka Nemoto wrote:
> Dear Guillaume, Volkmar, and other experts,
>
> Recently, I have several occasions to help "SPM newbie" install SPM on
> their PC. I'm getting tired of doing the same things over and over and
> explaining what the path is, so I wrote a tiny script which enables
> unpacking SPM8.zip, setting the path to MATLAB, and optimizing the
> memory setting in spm_defaults.m simultaneously. One of my colleagues
> liked the script and suggested to post the script to the mailing list.
> A good thing is that everything can be done in MATLAB and we don't
> have to use any third-party software to unzip the SPM8.zip. The
> shortcoming of this script is that we still have to manually edit the
> spm_defaults.m, though I think it is good to see the file anyway.
> Since I'm not so familiar with MATLAB programming, I would like to get
> some comments or opinions to see if there are ways to improve the
> script.
> (It should be OS independent, but I tested on Windows machine, so I'm
> not sure if this works on Mac OS X or Linux.)
>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %spm8_installation.m
> %This script helps you install SPM8 in your circumstance, especially for
> %Windows.
>
> StartButton = questdlg('Start SPM installation? DO NOT run this script
> if you already installed SPM8 on your PC.','SPM
> installation','Yes','No','Yes') ;
>
> switch StartButton
> case 'Yes',
> %decide the path to install SPM8. SPM8 will be unzipped under this
> %directory
> spm_installation_path = uigetdir('', ...
> 'Please choose the directory where you want to install SPM8');
> %specify the compressed SPM file.
> [fname, dpath,] = uigetfile('spm8.zip', ...
> 'Please select the SPM8 compressed file');
> spm_compressed = fullfile(dpath, fname);
> %unzip the spm file to the spm_installation_path
> unzip(spm_compressed,spm_installation_path);
> spm8_path=fullfile(spm_installation_path,'spm8');
> %Add path to the Matlab
> path(spm8_path, path);
> %Save the path to the Matlab
> PathButton = questdlg ...
> ('Do you want to save the path now? You can save the path later',...
> 'SPM Path Setting','Yes','Later','Yes') ;
> switch PathButton
> case 'Yes',
> savepath;
> h=msgbox('The path is saved.');
> case 'Later',
> h=warndlg('The path is NOT saved. You have to set the
> path for SPM when you run MATLAB next time.' );
> end
>
> uiwait(h)
>
> %Optimizing the memory setting
> spm8_defaults=fullfile(spm8_path,'spm_defaults.m');
> Memory = questdlg ...
> ('Specify the memory size of your computer','Memory setting',...
> '1GB','2GB','4GB','1GB');
> switch Memory
> case '1GB',
> h=msgbox('set defaults.stats.maxmem to 2^30 around the
> line 37 of spm_defaults.m');
> uiwait(h)
> open (spm8_defaults)
> case '2GB',
> h=msgbox('set defaults.stats.maxmem to 2^31 around the
> line 37 of spm_defaults.m');
> uiwait(h)
> open (spm8_defaults)
> case '4GB',
> h=msgbox('set defaults.stats.maxmem to 2^32 around the
> line 37 of spm_defaults.m');
> uiwait(h)
> open (spm8_defaults)
>
> end
>
>
> %Complete installation
> msgbox('Installation finished. Type "spm" in MATLAB command
> window to run SPM', ...
> 'installation finished');
> clear all
> case 'No',
> msgbox('Bye!','Bye');
> end
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG
|