glm flex fast4 script setup for regression

289 views
Skip to first unread message

Sam

unread,
Dec 19, 2015, 7:11:23 PM12/19/15
to Aaron's fMRI matlab tools.

Hi Aaron,

 

  Thank you so much for making these tools available! I’m pretty new to Matlab scripting and I’m encountering a few problems getting the GLM_Flex_Fast scripts up and running with my data. I have been able to install the full package of scripts and run the GLM_Flex_Fast2 script example script you provided using the accompanying example dataset on the webpage. In addition, I was able to reformat my file structure and rename the image files in my dataset to correspond to the naming pattern of the files in your example dataset. Doing this, I was again able to run the example script you provided, encountering no errors. So, I’m fairly certain my inability to alter the example script to run a simple regression analysis with my own data is due to my own scripting error/s.

 

I have attached a copy of this script and I was hoping you might be able to give it a look to see any misspecifications that stand out. Each change I try to make to the script seems to result in a different error occurring, so I’m not really certain what information would be most helpful to provide you in the context of troubleshooting. I have attempted to add comments thoroughly in the script, which I hope may help. Any assistance you are able to provide would be greatly appreciated. Thanks so much!

 

Sam
GLMFlex Input for Simple Regression

Aaron Schultz

unread,
Dec 20, 2015, 9:08:20 AM12/20/15
to fmri_mat...@googlegroups.com
The files don't need to be named in any particular way, rather the files need to align with the variable in dat.  In the example, the relevant information was coded in the file names, so it was possible to create the appropriate variables in dat by parsing the file names.

Looking at your script I see:

Scans = ('/home/swhawes/Sam_fMRI/fMRI_data/MJ/Faces_PCL/contrast0001/*.img');

that will make the Scans variable a literal.  You need to get the list of files which would require making a call to dir_wfp.

Scans = dir_wfp('/home/swhawes/Sam_fMRI/fMRI_data/MJ/Faces_PCL/contrast0001/*.img');

The same is at issue in:

PCL_Tot = ('/home/swhawes/Sam_fMRI/fMRI_Behavioral/PCL_Tot.dat');

which should be:

PCL_Tot = load('/home/swhawes/Sam_fMRI/fMRI_Behavioral/PCL_Tot.dat');

Next, I.Constant= dat.Const; is not needed.  If the constant is a variable in dat, then you're all set for specifying it in the model.

Those fixes should address the issues.

Also  keep in mind that you can you the function readtable.m to read excel files into matlab as a table object.  So if you have all of your variables of interest (you can even include the fill file paths to the input images), then you can just do:

dat = readtable('MyExcelFile.xlsx');

-Aaron


--
You received this message because you are subscribed to the Google Groups "Aaron's fMRI matlab tools." group.
To unsubscribe from this group and stop receiving emails from it, send an email to fmri_matlab_to...@googlegroups.com.
To post to this group, send email to fmri_mat...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fmri_matlab_tools/03ca3255-1fbf-4d4b-a513-6b022c684e33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sam

unread,
Jan 11, 2016, 3:20:42 PM1/11/16
to Aaron's fMRI matlab tools.
Hi Aaron,

  I hope the holidays treated you well and thanks so much for your response to my previous post! When I change the aspects of my script as suggested, replacing--
 
"Scans = ('/home/swhawes/Sam_fMRI/fMRI_data/MJ/Faces_PCL/contrast0001/*.img');"
"PCL_Tot = ('/home/swhawes/Sam_fMRI/fMRI_Behavioral/PCL_Tot.dat');"
with
"Scans = dir_wfp('/home/swhawes/Sam_fMRI/fMRI_data/MJ/Faces_PCL/contrast0001/*.img');"
"PCL_Tot = load('/home/swhawes/Sam_fMRI/fMRI_Behavioral/PCL_Tot.dat');"

I receive the error below when I attempt to run the script. Any thoughts/suggestions you may have would be greatly appreciated. Thanks again!

Setup/Check the I Structure:

Reading In Data:
Undefined function or variable 'spm_vol'.

Error in GLM_Flex_Fast4 (line 148)
        h = spm_vol(char(I.Scans));

Error in GLM_Flex_ExampleRR (line 31)
GLM_Flex_Fast4(I);

Sam

Aaron Schultz

unread,
Jan 11, 2016, 3:23:54 PM1/11/16
to Aaron's fMRI matlab tools.
It would appear that the SPM directories have not been added to the matlab path.

-Aaron

Sam

unread,
Jan 13, 2016, 3:09:24 PM1/13/16
to Aaron's fMRI matlab tools.
Yep, that worked, much appreciated!

Sam
Reply all
Reply to author
Forward
0 new messages