method that converts vol structs in design and converts to format 'ver' FORMAT o = convert_fo(o, ver) Input o - design object ver - optional version for vols from '99' or '5' Defaults to version for current SPM version Output o - object with converted vols Example % Convert vols to current format o = convert_vols(o); % Convert to native format for SPM99 designs o = convert_vols(o, native_vol_ver(o)); $Id$
0001 function o = convert_vols(o, ver) 0002 % method that converts vol structs in design and converts to format 'ver' 0003 % FORMAT o = convert_fo(o, ver) 0004 % 0005 % Input 0006 % o - design object 0007 % ver - optional version for vols from '99' or '5' 0008 % Defaults to version for current SPM version 0009 % 0010 % Output 0011 % o - object with converted vols 0012 % 0013 % Example 0014 % % Convert vols to current format 0015 % o = convert_vols(o); 0016 % 0017 % % Convert to native format for SPM99 designs 0018 % o = convert_vols(o, native_vol_ver(o)); 0019 % 0020 % $Id$ 0021 0022 if nargin < 2 0023 ver = mars_vol_utils('current_ver'); 0024 end 0025 0026 SPM = des_struct(o); 0027 SPM = sf_conv(SPM, ver, 'VY'); 0028 SPM = sf_conv(SPM, ver, 'xM', 'VM'); 0029 o = des_struct(o, SPM); 0030 0031 return 0032 0033 function S = sf_conv(S, ver, varargin) 0034 V = mars_struct('getifthere', S, varargin{:}); 0035 if ~isempty(V) 0036 V = mars_vol_utils('convert', V, ver); 0037 S = setfield(S, varargin{:}, V); 0038 end 0039 return