Dear Guillaume and Donald,
Thanks for your comments. I updated the script as below.
Can I ask you one more question?
In the other post you said,
---begin quote---
At last, just a word on defaults maxmem in spm_defaults.m. This value is
only used when estimating a GLM to see how much data can fit in memory
at the same time but it can never be more than a slice. It is not used
by any other processing. If you have out of memory errors when
estimating a GLM (rather unlikely), you would then rather decrease that
value. On the other hand, if you have lots of RAM and would like to have
SPM fitting more than a slice at a time, you can try to edit spm_spm.m
l.570 and remove "nbz = 1;".
---end quote---
(https://www.jiscmail.ac.uk/cgi-bin/wa.exe?A2=ind1002&L=SPM&P=R56715)
From this, value in the maxmem doesn't influence preprocessing. I
think most of people have out of memory error during preprocessing,
not GLM.
Are there any parameters we can set to avoid out of memory error
during preprocessing in SPM (providing we have already done the
suggestion by Mathworks 1106 & 1107 )?
Best regards,
Kiyotaka
%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
addpath(spm8_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',
open (spm8_defaults)
h=msgbox('set defaults.stats.maxmem to 2^29 around the
line 37 of spm_defaults.m');
uiwait(h)
case '2GB',
open (spm8_defaults)
h=msgbox('set defaults.stats.maxmem to 2^30 around the
line 37 of spm_defaults.m');
uiwait(h)
case '4GB',
open (spm8_defaults)
h=msgbox('set defaults.stats.maxmem to 2^31 around the
line 37 of spm_defaults.m');
uiwait(h)
end
%Check the installation
h=msgbox ...
('Now check the installation. See the Matlab window for
the result');
uiwait(h)
spm_check_installation('full')
%Complete installation
msgbox('Installation finished. Type "spm" in MATLAB command
window to run SPM', ...
'installation finished');
clear all
case 'No',
msgbox('Bye!','Bye');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2010/2/12 Guillaume Flandin <[log in to unmask]>:
> Hi Don,
>
> actually we do not recommend to use genpath.
> Instead just add the main SPM directory to the MATLAB path:
> addpath(spm_path)
> or from the MATLAB interface:
> File>Set Path> Add Folder... (and not Add with Subfolders...).
>
> The other required subdirectories (and only those) be added
> automatically when calling
> spm('defaults','fmri') % or 'eeg' or 'pet'
> spm_jobman('initcfg');
> (this is done automatically when starting the SPM interface).
>
> Best regards,
> Guillaume.
>
>
> MCLAREN, Donald wrote:
>> path(spm8_path, path)
>>
>> should be changed to:
>>
>> path(genpath(spm8_path), path)
>>
>> This ensures that subdirectories will be included in the path; otherwise
>> the batch processes won't run as matlabbatch dependencies are in a
>> subdirectory.
>>
>>
>> Best Regards, Donald McLaren
>> =================
>> D.G. McLaren
>> University of Wisconsin - Madison
>> Neuroscience Training Program
>> Office: (608) 520-0586
>> =====================
>> This e-mail contains CONFIDENTIAL INFORMATION which may contain
>> PROTECTED HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and
>> which is intended only for the use of the individual or entity named
>> above. If the reader of the e-mail is not the intended recipient or the
>> employee or agent responsible for delivering it to the intended
>> recipient, you are hereby notified that you are in possession of
>> confidential and privileged information. Any unauthorized use,
>> disclosure, copying or the taking of any action in reliance on the
>> contents of this information is strictly prohibited and may be unlawful.
>> If you have received this e-mail unintentionally, please immediately
>> notify the sender via telephone at (608) 520-0586 or email.
>>
--
Kiyotaka Nemoto, M.D.
Department of Psychiatry
Graduate School of Comprehensive Human Sciences
University of Tsukuba
1-1-1Tennodai Tsukuba, Ibaraki 305-8575, Japan
E-mail: [log in to unmask]
|