<div dir="ltr">Thank you! Yes, when I run isequal to compare the time of LFP_proc_ftdata and EEG_proc_ftdata variables it returns logical = 0. After importing the LFP data, it needs to be resampled to 100 Hz since the EEG data has a sampling rate of 100Hz.<div><br></div><div>When I look at the cell array for EEG_proc_ftdata.time, each cell in the array goes from 0.01 s to 30 s in 0.01 increments, whereas for LFP_proc_ftdata.time it is from (0.0070 s to 29.997 s in 0.01 increments). When looking at LFP_data (the LFP data before the 250 Hz to 100 Hz resampling), LFP_data.time is a cell array 1 x 1332  of 1 x 7500 double as expected, with time starting at 0.004 and going up in 0.004 increments. </div><div><br></div><div>Is there a way to get the time to align between the two so that they are equivalent (after LFP data is resampled from 250-->100Hz)?</div><div><br></div><div>Thanks!</div><div><br></div><div>The resampling code is:</div><div><div class="gmail-rtcContent" style="padding:30px"><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">cfg = [];</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">cfg.resamplefs = 100;</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre">LFP = ft_resampledata(cfg, LFP_data.ftdata);</span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><span style="white-space:pre"><br></span></div><div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace"><div class="gmail-rtcContent" style="padding:30px"><div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre">cfg               = [];</span></div><div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre">cfg.refchannel    = <span style="color:rgb(167,9,245)">'all'</span>;</span></div><div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre">cfg.reref         = <span style="color:rgb(167,9,245)">'yes'</span>; </span></div><div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre">cfg.refmethod     = <span style="color:rgb(167,9,245)">'bipolar'</span>;</span></div><div class="gmail-lineNode" style="font-size:10pt"></div><div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre">cfg.bpfilter       = <span style="color:rgb(167,9,245)">'yes'</span>;</span></div><div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre">cfg.bpfreq        = [1,49];</span></div><div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre">LFP_proc_ftdata = ft_preprocessing(cfg,LFP);</span></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 23, 2023 at 12:14 AM Schoffelen, J.M. (Jan Mathijs) via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div style="overflow-wrap: break-word;">
Hi Thilan,
<div><br>
</div>
<div>Have you checked the code? The section in ft_appenddata between line 128-136 should give you pointers to what is going on. </div>
<div><br>
</div>
<div>My conclusion would be that the condition on line 131 is not met - specifically  isequaltime=False - which causes the error.</div>
<div><br>
</div>
<div>I need to check the equality of the ’time’ field for the LFP_proc_ftdata and EEG_proc_ftdata variables. If this field numerically non-identical, the data cannot be appended.</div>
<div><br>
</div>
<div>Good luck,</div>
<div><br>
</div>
<div>Jan-Mathijs</div>
<div><br>
<div><br>
<blockquote type="cite">
<div>On 22 Mar 2023, at 22:11, Thilan Tudor via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>> wrote:</div>
<br>
<div>
<div dir="ltr">Hi,
<div><br>
</div>
<div>Thanks in advance for the help.</div>
<div><br>
</div>
<div>I am trying to use ft_appenddata to merge EEG and iEEG (LFP) data as input to run connectivity analysis with ft_connectivity (after processing this merged data with ft_freqanalysis).</div>
<div><br>
</div>
<div>EEG data has the following channels: 'F3', 'C3', 'A2', 'O1', 'F4', 'A1', 'C4', 'O2'</div>
<div>LFP data has the following channels: 'LFP1-LFP2', 'LFP2-LFP3'</div>
<div><br>
</div>
<div>
<div>For my same-subject data, I have the following (output from ft_preprocessing):</div>
<div><br>
</div>
LFP_proc_ftdata =<br>
<br>
  struct with fields:<br>
<br>
     trialinfo: [1332×1 double]<br>
       fsample: 100<br>
    sampleinfo: [1332×2 double]<br>
         trial: {1×1332 cell}<br>
          time: {1×1332 cell}<br>
         label: {2×1 cell}<br>
<div>           cfg: [1×1 struct]</div>
<div><br>
</div>
<div> EEG_proc_ftdata =</div>
<br>
  struct with fields:<br>
<br>
     trialinfo: [1332×1 double]<br>
       fsample: 100<br>
    sampleinfo: [1332×2 double]<br>
         trial: {1×1332 cell}<br>
          time: {1×1332 cell}<br>
         label: {8×1 cell}<br>
           cfg: [1×1 struct]<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>I get the following error when I run <br>
</div>
<div><span style="white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:10pt"><br>
</span></div>
<div><span style="white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:10pt">cfg = [];</span></div>
<div><span style="white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:10pt">data_merged = ft_appenddata(cfg, proc_ftdata, LFP_proc_ftdata);</span></div>
<div><br>
</div>
<div>Warning: the data has overlapping segments or originates from different recordings on disk
<br>
Warning: please consider specifying cfg.keepsampleinfo='no'<br>
</div>
<div>Error using ft_appenddata<br>
cannot append this data<br>
</div>
<div><br>
</div>
<div>Even when I specify cfg.keepsampleinfo='no', I still get "cannot append this data". Is the issue is that there are no common channels between the datasets to run ft_appenddata?</div>
<div><br>
</div>
<div><br>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7EgJtIjBH4urqXOsBt5AumsNVHmu3S-3OBeM3r5i7lv7AHktdaX0eNtbGne-Z8uDf5YfGcYGvHYdvhiSI1GkIpJaG9i2RSMNIwnbSw$" target="_blank">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7EgJtIjBH4urqXOsBt5AumsNVHmu3S-3OBeM3r5i7lv7AHktdaX0eNtbGne-Z8uDf5YfGcYGvHYdvhiSI1GkIpJaG9i2RSMNIwnbSw$</a>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</div>

_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!4HhTFhkQ4NNnYYjqXft8VorsOkAYUK4Utu8BmpP1ux2p-XxhGA4ZdzEpJFf1G397hNrXInhzxNPTYxe0CjmUIyLftA$" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div>