Home > marsbar > @mardo_2 > save_spm.m

save_spm

PURPOSE ^

method to save design as SPM format design structure

SYNOPSIS ^

function tf = save_spm(D, fname);

DESCRIPTION ^

 method to save design as SPM format design structure
 FORMAT tf = save_spm(D, fname);
 
 Inputs
 D      - design object
 fname  - filename
 
 Outputs
 tf     - flag ==1 if successful
 
 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function tf = save_spm(D, fname);
0002 % method to save design as SPM format design structure
0003 % FORMAT tf = save_spm(D, fname);
0004 %
0005 % Inputs
0006 % D      - design object
0007 % fname  - filename
0008 %
0009 % Outputs
0010 % tf     - flag ==1 if successful
0011 %
0012 % $Id$
0013   
0014 if nargin < 2
0015   fname = 'SPM.mat';
0016 end
0017 
0018 % Convert vols to native format
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

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019