Realising that this thread is more than a year old, I want to suggest what might be the actual reason for this error.
My EEG-data were produced by a 64-channel ANT digital EEG measure station (ANT, The Netherlands).
Very recently, I have switched to SPM12b. When trying to perform the epoch function on my data file using the batch, I received exactly the same error message:
Failed 'Epoching'
Index exceeds matrix dimensions.
In file "C:\Users\Jorne\Documents\Code\Matlab\Libraries\spm12b_r5918\spm_eeg_definetrial.m" (v5592), function "spm_eeg_definetrial" at line 147.
In file "C:\Users\Jorne\Documents\Code\Matlab\Libraries\spm12b_r5918\spm_eeg_epochs.m" (v5592), function "spm_eeg_epochs" at line 92.
In file "C:\Users\Jorne\Documents\Code\Matlab\Libraries\spm12b_r5918\config\spm_cfg_eeg_epochs.m" (v5377), function "eeg_epochs" at line 176.
The following modules did not run:
Failed: Epoching
I remember that in SPM8 the epoch function had its own interface with an event selection dialog. When I used that, everything worked fine, but there was an error in the automatically generated script. In this case, I had chosen event value '31', but in the script it showed '31 ', with two spaces. Except that these are no spaces, but characters with code zero. Apparently, in my data the event codes have a fixed length of four characters, padded with zero-coded characters. I discovered this when opening the script in Notepad++.
This is the relevant trial definition line, which had been generated by SPM8:
S.trialdef.eventvalue = {'31 '}, the spaces, which represent zero-coded characters, are red underlined in Matlab
Shortest solution was to change this to:
S.trialdef.eventvalue = {['31' char(0) char(0)]}
In my Epoch wrapper function I used a more generic version:
S.trialdef.eventvalue = [eventvalue repmat(char(0), 1, 4 - length(eventvalue))];
I hope this might still be useful.
|