saves data in def_struct as variables in .mat file FORMAT savestruct(object, matname) $Id$
0001 function savestruct(obj, filename) 0002 % saves data in def_struct as variables in .mat file 0003 % FORMAT savestruct(object, matname) 0004 % 0005 % $Id$ 0006 0007 if nargin ~= 2 0008 error('Need matfile name'); 0009 end 0010 0011 % allow args to be in reverse order 0012 if ischar(obj) 0013 tmp = obj; 0014 obj = filename; 0015 filename = tmp; 0016 end 0017 0018 % Convert vols to native format 0019 obj = convert_vols(obj, native_vol_ver(obj)); 0020 0021 % unobjectify marsy object before save 0022 SPM = des_struct(obj); 0023 if isfield(SPM, 'marsY') 0024 SPM.marsY = y_struct(SPM.marsY); 0025 end 0026 savestruct(SPM, filename) 0027 0028 return