How can I process continuous data without triggers?

Most of the FieldTrip documentation is written for a cognitive neuroscience audience, i.e. researchers that usually are performing experiments in which different stimuli are presented and where the subject performs different mental tasks.

However, you can also use FieldTrip for analyzing continuous data that does not contain any triggers. One way for processing continuous data is to read it as a single, very long data segment. That is done by skipping ft_definetrial and by calling ft_preprocessing like this

cfg = [];
cfg.dataset = 'yourfile.ext';
...                               % further specification of filter settings etc. 
data = ft_preprocessing(cfg);

This will give you a raw data structure containing all continuous data represented as a single, very long trial. You can plot it with

plot(data.time{1}, data.trial{1});

For some analyses, e.g. spectral power estimation, it is better to have the data in smaller chucks. You can segment the continuous data after reading it into Matlab using ft_redefinetrial or while reading it in using the following configuration:

cfg = [];
cfg.dataset              = 'yourfile.ext';
cfg.trialfun             = 'ft_trialfun_general';
cfg.trialdef.triallength = 1;                   % in seconds
cfg.trialdef.ntrials     = inf;                 % i.e. the complete file
cfg = ft_definetrial(cfg);                         % this creates 1-second data segments
...                                             % further specification of filter settings etc. 
data = ft_preprocessing(cfg);

This uses the ft_trialfun_general function to segment the data. This function is included in FieldTrip, type help trialfun_general for more details.

An example for making overlapping segments

cfg = [];
cfg.dataset     = 'yourfile.ext';

hdr             = ft_read_header(cfg.dataset);
begsample       = 1:256:hdr.nSamples;             % slide with 256 samples
endsample       = begsample + 512 - 1;            % the segment length is 512 samples
offset          = zeros(size(begsample));

cfg.trl         = [begsample(:) endsample(:) offset(:)]

sel             = find(endsample>hdr.nSamples);
cfg.trl(sel, :) = [];                             % remove the segments that are beyond the end of the file

data = ft_preprocessing(cfg);
faq/how_can_i_process_continuous_data_without_triggers.txt · Last modified: 2014/09/18 08:30 by robert

You are here: startfaqhow_can_i_process_continuous_data_without_triggers
CC Attribution-Share Alike 3.0 Unported Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0
This DokuWiki features an Anymorphic Webdesign theme, customised by Eelke Spaak and Stephen Whitmarsh.
Mobile Analytics Website Security Test