Differences

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

Link to this comparison view

Both sides previous revision Previous revision
tutorial:nirs_multichannel [2018/07/27 12:07]
sophie [Plot results]
tutorial:nirs_multichannel [2018/08/08 16:36] (current)
jmhorschig changing all instances of data_flt to data_down
Line 214: Line 214:
 smp002 = [event(adc002).sample]’;​ smp002 = [event(adc002).sample]’;​
  
-factor = data_raw.fsample / data_flt.fsample+factor = data_raw.fsample / data_down.fsample
  
 % get the sample number after downsampling % get the sample number after downsampling
Line 220: Line 220:
 smp002 = round((smp002-1)/​factor + 1); smp002 = round((smp002-1)/​factor + 1);
  
-pre    =  round( 5*data_flt.fsample);​ +pre    =  round( 5*data_down.fsample);​ 
-post   ​= ​ round(20*data_flt.fsample);+post   ​= ​ round(20*data_down.fsample);
 offset = -pre; % see ft_definetrial offset = -pre; % see ft_definetrial
  
Line 238: Line 238:
  
 % remove trials that stretch beyond the end of the recording % remove trials that stretch beyond the end of the recording
-sel = trl(:,​2)<​size(data_flt.trial{1},​2);​+sel = trl(:,​2)<​size(data_down.trial{1},​2);​
 trl = trl(sel,:); trl = trl(sel,:);
  
 cfg = [] cfg = []
 cfg.trl = trl cfg.trl = trl
-data_epoch = ft_redefinetrial(cfg,​data_flt);+data_epoch = ft_redefinetrial(cfg,​data_down);
 </​code>​ </​code>​
  
Line 264: Line 264:
 </​code>​ </​code>​
  
-Notably, both trial and time fields will now have 1x597 cell array (compare this to data_flt). This corresponds to the 597 stimuli that were presented. In data_epoch.trialinfo the information about the type of stimulus is stored (event 1 or event 2). Thus, we can find which of those cells belongs to the first deviant:+Notably, both trial and time fields will now have 1x597 cell array (compare this to data_down). This corresponds to the 597 stimuli that were presented. In data_epoch.trialinfo the information about the type of stimulus is stored (event 1 or event 2). Thus, we can find which of those cells belongs to the first deviant:
  
   idx = find(data_epoch.trialinfo==2,​1,'​first'​)   idx = find(data_epoch.trialinfo==2,​1,'​first'​)