Brain Mapping Center

How To Import SPM Tables into Excel

I wrote a MATLAB program to export SPM statistic tables into a tab-delineated file suitable for Excel.


After you hit the volume button and get a list of data points, right click in the background of the table. A menu will show up, and choose the option "Extract_table data structure." This will extract the data table structure and put it into a temporary MATLAB environment variable named ans. In the UNIX MATLAB text window, type the following:

DatTab=ans;
spm_print_list(DatTab)

The 1st line copies the variable ans to the new variable DatTab. The second line calls a function that will print the table to an ASCII file called "SPM.txt", which you can then fetch to excel or whatever. If the file doesn't exist it will be created; if it does exist, it will be appended to.

If you would like to save it to a different filename, there are additional parameters:

spm_print_list(DatTab,c,fname)

c is the starting column to print from (defaults to 1). If you want to ignore the 1st 3 columns, then put in 4 to start printing from the 4th column.

fname is the filename you want to save.

Ex:
spm_print_list(DatTab,2,'recall-learn.txt')

will print starting at column 2 to the file recall-learn.txt

NOTE: In order to do this, you need to copy the file "spm_print_list.m" from /data/cohen/michael/spm99 to your spm directory. Otherwise, you will get a "??? Undefined function or variable 'spm_print_list'" error.

Thanks to Michael Zeineh for the info...
 
 


this page is maintained by fred8.31.00