<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 5 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="FR" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Jan-Mathijs,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks a lot for your response and explanations.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It is exactly as you wrote with ft_appenddata when not keeping the sampleinfo. I end up with two trials of continuous data. But in that case all the events of the individual datasets are lost, and that’s an issue for me.</p>
<p class="MsoNormal">Maybe I can find a workaround, but worse case I will just have to treat the blocks as different recordings.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks again for your explanations, it really helps.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best regards,</p>
<p class="MsoNormal">Éva<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="border:none;padding:0cm"><b>De : </b><a href="mailto:fieldtrip@science.ru.nl">Schoffelen, J.M. (Jan Mathijs) via fieldtrip</a><br>
<b>Envoyé le :</b>vendredi 27 janvier 2023 09:55<br>
<b>À : </b><a href="mailto:fieldtrip@science.ru.nl">FieldTrip discussion list</a><br>
<b>Cc : </b><a href="mailto:janmathijs.schoffelen@donders.ru.nl">Schoffelen, J.M. (Jan Mathijs)</a><br>
<b>Objet :</b>Re: [FieldTrip] Trying to merge blocks of data using ft_appenddata</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Éva, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I don’t completely follow your exposition, but I don’t understand well why you think that you should use cfg.keepsampleinfo = ‘yes’ for the reason that you mentioned:<i>  (QUOTE): 'Even though the files are separated, they should contain
 the same events, so I kept the option cfg.keepsampleinfo = 'yes’.’</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">If you retain the sampleinfo in the data structures that come from different files, the mapping from recorded samples to samples present in the data structure - which is what the sampleinfo reflects - results in conflicting information.
 Let’s say that you have two recordings (with a length of 100 samples) that are read in into a fieldtrip structure. If you retain the sampleinfo, both datastructures will  have a sampleinfo [1 100]. The later check (in ft_fetch_data, called by a subfunction
 of ft_databrowser) investigates (in case of a sampleinfo being present, and in that case based on the sampleinfo), whether the data segments are overlapping - under the assumption that the segments are derived from the same recording. In your case it fails. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Now, you also mention ft_appenddata in passing. I don’t know what this has to do with it, but I guess that you tried this function to append the two data structures. I don’t know how by heart how clever this function is, so it could be
 that it did not work in your case. I suspect that if you get rid of the sampleinfo, things will work out fine.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Best wishes,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Jan-Mathijs<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On 26 Jan 2023, at 22:49, Eva Masson via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Dear FieldTrip community,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I am trying to merge two blocks of (so far) continuous data. The recordings are the same in the sense that they have the same number of channels. The files contain events, but I have not defined trials yet. (as a side note, I tried merging
 with defined trials in both blocks, but the issue is the same)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">To do so, after I transformed my .set files into a fieldtrip structure, I tried using ft_appenddata.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Even though the files are separated, they should contain the same events, so I kept the option<span class="apple-converted-space"> </span><i>cfg.keepsampleinfo = 'yes'</i>.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">In appearances, the obtained structure is what I expected (twice as much data as a single file). But when I try to visualize the raw data with ft_databrowser, I get the following error:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>Error using ft_fetch_data</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>some of the requested samples occur twice in the data and have conflicting values</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i> </i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>Error in ft_databrowser>redraw_cb (line 1807)</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>  dat = ft_fetch_data(opt.orgdata, 'header', opt.hdr, 'begsample', begsample, 'endsample', endsample, 'chanindx', chanindx, 'allowoverlap', cfg.allowoverlap, 'skipcheckdata', true);</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i> </i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>Error in ft_databrowser (line 810)</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i>redraw_cb(h);</i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><i> </i><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">From my understanding (<i>'the trials will be concatenated'</i>, from documentation), I expect ft_appenddata to merge the data as data1 followed by data2 as a big continuous data file. Is there a misunderstanding of how ft_appenddata actually
 works? Or is it a sign for a design issue of my experiment?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you very much for your help.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Éva<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif">_______________________________________________<br>
fieldtrip mailing list<br>
</span><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</span></a><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif"><br>
</span><a href="https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!6lL40jy3LPXM6ebwJoPRKwNXe8x0-9B5MXorSFIBF23I7oazUFZ1XuiaRSP5lI2xV7y8DFyXjr8iVytp-ARtO48Wgmu5EoPogJd-0Q$"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!6lL40jy3LPXM6ebwJoPRKwNXe8x0-9B5MXorSFIBF23I7oazUFZ1XuiaRSP5lI2xV7y8DFyXjr8iVytp-ARtO48Wgmu5EoPogJd-0Q$</span></a><o:p></o:p></p>
</div>
</blockquote>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>