Hi,
In my dataset, there's some unpredictable temporal jitter between the timing of stimuli and the triggers encoded in the data. I have a way of correcting for this, as we have recorded a photodiode trace from which the timing of stimuli can be extracted. Loading each recording session as a continuous dataset, I can produce a new trigger-like vector of the same length as the vector produced by doing trigs = D(triggerchannel,:,:), which is zero wherever there was no stimulus, but jumps for one sample to the appropriate trigger value wherever there was a stimulus: that is, it's similar to the trigger channel, but with the temporal jitter corrected.
My plan was to replace the original trigger channel in each of my datasets with this new trigger channel, and use these new corrected triggers for subsequent epoching. I tried to do this by doing:
D(triggerchannel,:,1) = newTriggerChannel;
D.save;
where 'triggerchannel' is the number of the trigger channel in the dataset (MEG acquired on an Electa Neuromag system, converted by SPM from the .fif files).
On loading the data again, the trigger channel does seem to contain my corrected triggers - but when epoching using spm_eeg_epochs the epoching uses the old triggers. Is this is because somewhere else inside the data object there is a list of events/event times which were created when the data was read from the .fif file?
My question is: is the above approach (replacing the trigger channel) possible, and if so, how might I get it to work? If it isn't, I guess my best bet might be to write my own function to extract trials from my new trigger vector, and save this trial definition along with the dataset?
Many thanks,
George Wallis
|