[FieldTrip] appending data from two recordings

Anne Urai anne.urai at gmail.com
Tue Oct 21 11:39:14 CEST 2014

Hi Phyllis,

I have a similar situation - ft_databrowser after appending - and I solved the problem of not seeing events at the right times by manually rebuilding them. For artefact rejection I found it important to know when in the trial eg. blinks occurred. There is the (undocumented?) cfg.event input option, which I used in the following way

        for t = 1:length(data.trial),
            % get the distance between each event and the start of the trial
            samples(t,1) = trl(t,2)-trl(t,1); %int1
            samples(t,2) = trl(t,5)-trl(t,1); %int2
            samples(t,3) = trl(t,8)-trl(t,1); %resp
            samples(t,4) = trl(t,10)-trl(t,1); %fb
            % add the length of this trial
            samples(t,:) = samples(t,:) + (12*600*t-1);
        samples = reshape(samples', 1, numel(samples));
        % create events structure to feed into databrowser
        for i = 1:length(samples),
            e(i).type = 'x';
            e(i).sample = samples(i);
            e(i).value = [];
            e(i).offset = 0;
            e(i).duration = 1;
        cfg.event = e;

        cfg = ft_databrowser(cfg, data);

in which the trl matrix I use has samples of events at column 2, 5, 8, and 10, and the first column has the start of the trial in samples. Also, each trial takes 12 seconds at sampling rate 600 Hz. For trials of unequal length, you need to do a bit better bookkeeping on the assumption that fieldtrip treats epoched data as continuous data from the same recording.

Hope this helps!

Anne E. Urai, MSc
PhD student | Institute for Neuro- and Pathophysiology | University Medical Center Hamburg-Eppendorf  | Hamburg, Germany | anneurai.wordpress.com

On 14 Mar 2014, at 14:11, Jörn M. Horschig <jm.horschig at donders.ru.nl> wrote:

> Heyho,
> yes, I think the databrowser digs deep down in data.cfg to obtain the original event-matrix of your dataset. After the sampleinfo-field is reconstructed, the databrowser tries to relate the sampleinfo field with the original event-structure. As the two have nothing in common anymore, the output will of course be nonsense. Removing the cfg is imho the only option to prvent the databrowser from doing so. But this is clearly something that the databrowser should not do, because we want a smart databrowser, not a stupid one ;)
> Phyllis, could you be so kind to open up a bug on bugzilla.fcdonders.nl about this? Just shortly describe what you are doing in terms of code and describing the error would be sufficient. We will then take care that this get's solved in future versions.
> If you have questions about bugzilla or if you do not want to post the bug there, please let me/us know. But we'd appreciate if you could open up a bug :) Thanks in any case for your message!
> Best,
> Jörn
> On 3/14/2014 1:52 PM, Phyllis Mania wrote:
>> Dear Eelke,
>> Calling ‘rmfield’ helped, thank you!
>> Cheers,
>> Phyllis
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> -- 
> Jörn M. Horschig
> PhD Student
> Donders Institute for Brain, Cognition and Behaviour
> Centre for Cognitive Neuroimaging
> Radboud University Nijmegen
> Neuronal Oscillations Group
> FieldTrip Development Team
> P.O. Box 9101
> NL-6500 HB Nijmegen
> The Netherlands
> Contact:
> E-Mail: jm.horschig at donders.ru.nl
> Tel:    +31-(0)24-36-68493
> Web: http://www.ru.nl/donders
> Visiting address:
> Trigon, room 2.30
> Kapittelweg 29
> NL-6525 EN Nijmegen
> The Netherlands
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141021/af824253/attachment-0001.html>

More information about the fieldtrip mailing list