0001 function tf = save_spm(D, fname);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 if nargin < 2
0015 fname = 'SPM.mat';
0016 end
0017
0018
0019 D = convert_vols(D, native_vol_ver(D));
0020
0021 SPM = des_struct(D);
0022 if ~mars_utils('isabspath', fname)
0023 Swd = mars_struct('getifthere', SPM, 'swd');
0024 if isempty(Swd)
0025 error('No path passed, and none in design');
0026 end
0027 fname = fullfile(Swd, fname);
0028 else
0029 SPM.swd = fileparts(fname);
0030 end
0031
0032
0033 try
0034 if verbose(D)
0035 fprintf('Saving design to file %s\n', fname);
0036 end
0037 save(fname, 'SPM');
0038 tf = 1;
0039 catch
0040 warning(lasterr);
0041 tf = 0;
0042 end