<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Thilan,
<div class=""><br class="">
</div>
<div class="">If you read the docstring of ft_resampledata in detail, you will find the answer: rather than using cfg.resamplefs, you could use cfg.time = EEG_proc_ftddata.time</div>
<div class=""><br class="">
</div>
<div class="">Good luck,</div>
<div class="">Jan-Mathijs<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 23 Mar 2023, at 11:16, Thilan Tudor via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">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 class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">Thanks!</div>
<div class=""><br class="">
</div>
<div class="">The resampling code is:</div>
<div class="">
<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" class="">cfg = [];</span></div>
<div class="gmail-lineNode" style="font-size:10pt;font-family:Menlo,Monaco,Consolas,"Courier New",monospace">
<span style="white-space:pre" class="">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" class="">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" class=""><br class="">
</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" class="">cfg = [];</span></div>
<div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre" class="">cfg.refchannel =
<span style="color:rgb(167,9,245)" class="">'all'</span>;</span></div>
<div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre" class="">cfg.reref =
<span style="color:rgb(167,9,245)" class="">'yes'</span>; </span></div>
<div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre" class="">cfg.refmethod =
<span style="color:rgb(167,9,245)" class="">'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" class="">cfg.bpfilter =
<span style="color:rgb(167,9,245)" class="">'yes'</span>;</span></div>
<div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre" class="">cfg.bpfreq = [1,49];</span></div>
<div class="gmail-lineNode" style="font-size:10pt"><span style="white-space:pre" class="">LFP_proc_ftdata = ft_preprocessing(cfg,LFP);</span></div>
</div>
</div>
</div>
</div>
</div>
<br class="">
<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" class="">fieldtrip@science.ru.nl</a>> wrote:<br class="">
</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;" class="">Hi Thilan,
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">My conclusion would be that the condition on line 131 is not met - specifically isequaltime=False - which causes the error.</div>
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">Good luck,</div>
<div class=""><br class="">
</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On 22 Mar 2023, at 22:11, Thilan Tudor via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" target="_blank" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="">
<div class="">
<div dir="ltr" class="">Hi,
<div class=""><br class="">
</div>
<div class="">Thanks in advance for the help.</div>
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">EEG data has the following channels: 'F3', 'C3', 'A2', 'O1', 'F4', 'A1', 'C4', 'O2'</div>
<div class="">LFP data has the following channels: 'LFP1-LFP2', 'LFP2-LFP3'</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">For my same-subject data, I have the following (output from ft_preprocessing):</div>
<div class=""><br class="">
</div>
LFP_proc_ftdata =<br class="">
<br class="">
struct with fields:<br class="">
<br class="">
trialinfo: [1332×1 double]<br class="">
fsample: 100<br class="">
sampleinfo: [1332×2 double]<br class="">
trial: {1×1332 cell}<br class="">
time: {1×1332 cell}<br class="">
label: {2×1 cell}<br class="">
<div class=""> cfg: [1×1 struct]</div>
<div class=""><br class="">
</div>
<div class=""> EEG_proc_ftdata =</div>
<br class="">
struct with fields:<br class="">
<br class="">
trialinfo: [1332×1 double]<br class="">
fsample: 100<br class="">
sampleinfo: [1332×2 double]<br class="">
trial: {1×1332 cell}<br class="">
time: {1×1332 cell}<br class="">
label: {8×1 cell}<br class="">
cfg: [1×1 struct]<br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">I get the following error when I run <br class="">
</div>
<div class=""><span style="white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:10pt" class=""><br class="">
</span></div>
<div class=""><span style="white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:10pt" class="">cfg = [];</span></div>
<div class=""><span style="white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:10pt" class="">data_merged = ft_appenddata(cfg, proc_ftdata, LFP_proc_ftdata);</span></div>
<div class=""><br class="">
</div>
<div class="">Warning: the data has overlapping segments or originates from different recordings on disk
<br class="">
Warning: please consider specifying cfg.keepsampleinfo='no'<br class="">
</div>
<div class="">Error using ft_appenddata<br class="">
cannot append this data<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
<a href="https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7EgJtIjBH4urqXOsBt5AumsNVHmu3S-3OBeM3r5i7lv7AHktdaX0eNtbGne-Z8uDf5YfGcYGvHYdvhiSI1GkIpJaG9i2RSMNIwnbSw$" target="_blank" class="">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7EgJtIjBH4urqXOsBt5AumsNVHmu3S-3OBeM3r5i7lv7AHktdaX0eNtbGne-Z8uDf5YfGcYGvHYdvhiSI1GkIpJaG9i2RSMNIwnbSw$</a>
<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
<a href="https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!4HhTFhkQ4NNnYYjqXft8VorsOkAYUK4Utu8BmpP1ux2p-XxhGA4ZdzEpJFf1G397hNrXInhzxNPTYxe0CjmUIyLftA$" rel="noreferrer" target="_blank" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
</blockquote>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!53ecOY0O6i3upaQ-_1d4vjyH14--_GCRA0MVyi3px6OMoAj18bnxtyCjjm8vpd2a5Sy_RFlnpNFnA8AudJWSR8WbNMj5id0iq01-yg$
<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>