SPM
Extracting Event Onsets from MATLAB Data Files
Analyses of fMRI (as opposed to rs-MRI) are built on regressions of observed time-series data on predicted time-series data. The predicted time-series are derived from the onsets of different types of events of interests (e.g., at what points in time was the participant experiencing Condition A and/or Condition B?).
If the event onsets can be assumed to be constant across participants, an onsets file (either in plaintext or .mat format) can be created from the known experimental paradigm. If the event onsets are variable across participants, or if one wants to be extremely precise about stimulus timing, these event onsets can be derived from each participant's MATLAB data file generated during the experiment.
A MATLAB function, TSExtractor has been written, and can be found in the UBFS Scripts/Matlab/ folder. If a copy of this file is in your MATLAB path, you can use the TSExtractor function to generate SPM onsets files from these experiment data files.
- If TSExtractor.m is not already in your MATLAB path, open a terminal window and copy it there:
cp ~/ubfs/cpmcnorg/Scripts/Matlab/TSExtractor.m ~/Documents/MATLAB/
- Start MATLAB, and read the TSExtractor help for an explanation and sample usage:
>>help TSExtractor
- In MATLAB, navigate to the directory containing the .mat files containing the experiment data from which you wish to extract the event onsets
- It is not strictly necessary to navigate to this directory, however if your files are located in a different directory, you will be required to provide an additional parameter to TSExtractor indicating where the files are to be found. Otherwise, the function simply assumes that these files are found in your current directory.
- Execute TSExtractor on each of the .mat files. E.g.,
>> d=datenum('19-Nov-2015');
>> TSExtractor('prefix', 'LDT_', 'subject', 1000, 'run', 1, 'date', d);