Differences

This shows you the differences between two versions of the page.

Link to this comparison view

faq:how_can_i_process_continuous_data_without_triggers [2012/10/31 15:01]
131.174.45.83 [How can I process continuous data without triggers?]
faq:how_can_i_process_continuous_data_without_triggers [2017/08/17 11:21]
Line 1: Line 1:
-{{tag>​preprocessing raw faq}} 
- 
-====== 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 **[[:​reference:​ft_definetrial|ft_definetrial]]** and by calling **[[:​reference:​ft_preprocessing|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 **[[:​reference:​ft_redefinetrial|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 **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 ===== 
- 
-<​code>​ 
-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);​ 
-</​code>​ 
- 
-