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
For some analyses, e.g. spectral power estimation, it is better to have the data in smaller chunks. 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);