Dear List, Joaquin, John,
for the record, i think i found a fix for the problem some folks consistently reported a few months ago when using SPM2 with matlab 2006b (which officially is not tested for the old SPM2 software, as I read, as SPM2 seems 'end of life'?). See below, perhaps this is of help to others. I do not guarantee no other issues arise with this discontinued package in matlab2006b, but here things are fine after this fix.
see for example for a complete description of the error by Joaquin:
http://www.jiscmail.ac.uk/cgi-bin/wa.exe?A2=ind0701&L=SPM&P=R51788&I=-3
Some in our group still use SPM2, and also experienced this very same error when we switched from matlab2006a to 2006b. The weird thing was that it did not happen on all platforms, and even only for some linux filesystems and not for others.
----- DIAGNOSIS ----
I did some research, and it appeared one single issue. The file 'mask.img' is not generated after model estimation when using 2006b (but mask.hdr is!), and therefore estimating smoothnes, that wants to mask out voxels outside the brain, fails. So the problem lies earlier, and is originating in spm_create_vol.m. It appears that the matlab 'fopen' function (for file creation) with the somewhat exotic option 'r+' (read & write access, do NOT create file) gives different return arguments in matlab2006a and 2006b (i tried both, under linux), on SOME linux file systems (and perhaps others, didnt test it). The new arguments makes much more sense, but SPM2 worked around the strange value for earlier matlab versions (see line 2004 and further of spm_create_vol), which goes wrong for matlab2006b (works well in matlab2006a).
--------- ATTENTION: FIX STARTS HERE! -----
So in short, to fix this, do the following.
in spm_create_vol.m (we use % @(#)spm_create_vol.m 2.13 John Ashburner 03/04/29):
you see around lines 201-210:
201 if nargin==1 | ~strcmp(varargin{1},'noopen'),
202 fname = fullfile(pth,[nam, '.img']);
203 V.private.fid = fopen(fname,'r+',mach);
204 if (V.private.fid == -1)
205 V.private.fid = fopen(fname,'w',mach);
206 if (V.private.fid == -1),
207 error(['Error opening ' fname '. Check that you have write permission.']);
208 end;
209 end;
210 end;
Replace line 204 ('if (V.private.fid== -1).....') with the following:
204 if (V.private.fid == -1) | ~exist([pwd,filesep,fname]), %latest argument (exist...) added by Bas Neggers for matlab2006b compatibility
and spm2 works perfectly for in matlab2006b! At least it seems to do here. SPM folks: (John?), is this something for a late spm2 updates package?
Good luck all,
Bas
-------------------------------------------------
Dr. S.F.W. Neggers
Division of Brain Research
Rudolf Magnus Institute for Neuroscience
Utrecht University Medical Center
Visiting : Heidelberglaan 100, 3584 CX Utrecht
Room A.00.1.24
Mail : Huispost A.01.126, P.O. Box
3508 GA Utrecht, the Netherlands
Tel : +31 (0)30 2503386 Fax : +31 (0)30 2505443
E-mail : [log in to unmask] Web : http://www.fmri.nl/people/bas.html
--------------------------------------------------
|