0001 function [XYZ, Z, M] = pr_get_spm_results;
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 errstr = '''Cannot find SPM results in workspace''';
0013 [XYZ Z M] = deal([]);
0014
0015 V = spm('ver');
0016 switch V(4:end)
0017 case '99'
0018 have_res = evalin('base', 'exist(''SPM'', ''var'')');
0019 if ~have_res, return, end
0020 SPM = evalin('base', 'SPM', ['error(' errstr ')']);
0021 XYZ = SPM.XYZ;
0022 Z = SPM.Z;
0023 M = evalin('base', 'VOL.M', ['error(' errstr ')']);
0024 case '2'
0025 have_res = evalin('base', 'exist(''xSPM'', ''var'')');
0026 if ~have_res, return, end
0027 xSPM = evalin('base', 'xSPM', ['error(' errstr ')']);
0028 XYZ = xSPM.XYZ;
0029 Z = xSPM.Z;
0030 M = xSPM.M;
0031 otherwise
0032 error(['Strange SPM version ' V]);
0033 end