Hi Stephen and Jan-Mathijs,<br /><br />Thanks for your replies! I indeed did not need to add a trigger, i just didnt define the timewindow (with respect to the first trigger code) correctly before. Now its working just fine<br /><br />Thanks for your help, <br /><br />Boukje<br /><br /><span>Am 05.12.17 12:12 schrieb fieldtrip-request@science.ru.nl:</span><blockquote cite="mid:mailman.9.1512471602.5237.fieldtrip@science.ru.nl" class="iwcQuote" style="border-left: 1px solid #00F; padding-left: 13px; margin-left: 0;" type="cite"><div class="mimetype-text-plain">Send fieldtrip mailing list submissions to<br />  fieldtrip@science.ru.nl<br /><br />To subscribe or unsubscribe via the World Wide Web, visit<br />    <a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="l">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br />or, via email, send a message with subject or body 'help' to<br />  fieldtrip-request@science.ru.nl<br /><br />You can reach the person managing the list at<br />        fieldtrip-owner@science.ru.nl<br /><br />When replying, please edit your Subject line so it is more specific<br />than "Re: Contents of fieldtrip digest..."<br /><br /><br />Today's Topics:<br /><br />   1. Question about segmentation (Boukje Habets)<br />   2. Re: Question about segmentation (Stephen Whitmarsh)<br />   3. Re: Question about segmentation (Schoffelen, J.M. (Jan Mathijs))<br /><br /><br />----------------------------------------------------------------------<br /><br />Message: 1<br />Date: Tue, 05 Dec 2017 10:55:28 +0100<br />From: Boukje Habets <boukje.habets@uni-bielefeld.de><br />To: fieldtrip@science.ru.nl<br />Subject: [FieldTrip] Question about segmentation<br />Message-ID: <71c0e7f647c8c.5a267b20@uni-bielefeld.de><br />Content-Type: text/plain; charset="us-ascii"<br /><br />Dear Fieldtrippers,<br /><br />Im new to Fieldtrip and have a question about segmentation. I want to do a freqanalysis on EEG data (Brainvision Recorder).<br />I have one file per condition (so only containing one trigger code, and a start code at the beginning of the file) that i want to segment into 2sec pieces. Ive been trying to find a way to add a trigger with Fieldtrip, so that I can segment around a new trigger. Using a pre- and poststim timewindow around the trigger code is not a solution, as this gives me overlapping segments, which i do not want. <br />This doesnt seem possible?<br /><br />After reading about cfg.trialfun, I saw that i can segment a continuous file into segments that i can define in terms of length (sec/samples). I guess this is the easiest way for me to segment my file. However, i want to be able to define the start and end point of segmentation, as my file contains a part in the beginning without codes (EEG was being recorded, but experiment was running yet). I have been playing around with the commands begsample and endsample, but that didnt change the window of segmentation (meaning it always segments my whole file, giving me 'empty' segments).<br /><br />Does anybody know how to solve this?<br /><br />Thanks for your time,<br /><br />Boukje Habets<br /><br />-- <br /><br />Dr. Boukje Habets<br />Biopsychology & Cognitive Neuroscience (AE14)<br />Faculty of Psychology and Sports Science | Bielefeld University<br />PO-Box 100131 | D-33501 Bielefeld, Germany<br />Phone: (49) 521 - 106 67 533 | Fax: (49) 521 - 106 15 67 530<br />Office: UHG T3-250<br />----------------------------------------------------------------<br />-------------- next part --------------<br />An HTML attachment was scrubbed...<br />URL: <<a href="http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20171205/a2e5b190/attachment-0001.html" target="l">http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20171205/a2e5b190/attachment-0001.html</a>><br /><br />------------------------------<br /><br />Message: 2<br />Date: Tue, 5 Dec 2017 11:52:16 +0100<br />From: Stephen Whitmarsh <stephen.whitmarsh@gmail.com><br />To: FieldTrip discussion list <fieldtrip@science.ru.nl><br />Subject: Re: [FieldTrip] Question about segmentation<br />Message-ID:<br />    <CAFrxm=x11ZT4pXk+tY5jkUMEM=150feSyhWCMWhqPmzTHQ-nKA@mail.gmail.com><br />Content-Type: text/plain; charset="utf-8"<br /><br />Hi Boukje,<br /><br />Your question is not totally clear to me, so apologies if this is not what<br />you mean. I gather that you want to segment your data into non-overlapping<br />2-sec intervals, starting at a single trigger in your data?<br /><br />In any case, everything is possible, it just relies on understanding of the<br />trl structure (always defined in samplenumbers) and the use of<br />ft_preprocessing (in your case to read data and replace samples into a<br />time-axis) and ft_redefinetrial (can be done afterwards)<br /><br />It you only want to segment your data into non-overlapping 2-sec intervals<br />you could do something like this:<br /><br />   1. Use ft_preprocessing to read all your data as one long trial relative<br />   to your first trigger. For this you will need to enter a .trl field that<br />   has a single row with start, end, and offset in samplenr. You can get the<br />   sample number of your trigger (as well as the (relative) beginning and end<br />   sample numbers) using ft_read_events. The output of ft_preprocessing will<br />   give you a single trial defined in time around your trigger.<br />   2. You can then use ft_redefinetrial to segment the data into short<br />   (non-overlapping) segments. Check it's help for details. But realize you<br />   will now define segments in terms of time, not samples.<br /><br />The benefit of this order of things is that in the first preprocessing step<br />you can do things like filtering on the whole dataset, if you can spare the<br />RAM.<br /><br />Hope this helps,<br />Stephen<br /><br /><br /><br /><br /><br /><<a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon" target="l">https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon</a>><br />Virus-free.<br />www.avast.com<br /><<a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link" target="l">https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link</a>><br /><#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2><br /><br />On 5 December 2017 at 10:55, Boukje Habets <boukje.habets@uni-bielefeld.de><br />wrote:<br /><br />> Dear Fieldtrippers,<br />><br />> Im new to Fieldtrip and have a question about segmentation. I want to do a<br />> freqanalysis on EEG data (Brainvision Recorder).<br />> I have one file per condition (so only containing one trigger code, and a<br />> start code at the beginning of the file) that i want to segment into 2sec<br />> pieces. Ive been trying to find a way to add a trigger with Fieldtrip, so<br />> that I can segment around a new trigger. Using a pre- and poststim<br />> timewindow around the trigger code is not a solution, as this gives me<br />> overlapping segments, which i do not want.<br />> This doesnt seem possible?<br />><br />> After reading about cfg.trialfun, I saw that i can segment a continuous<br />> file into segments that i can define in terms of length (sec/samples). I<br />> guess this is the easiest way for me to segment my file. However, i want to<br />> be able to define the start and end point of segmentation, as my file<br />> contains a part in the beginning without codes (EEG was being recorded, but<br />> experiment was running yet). I have been playing around with the commands<br />> begsample and endsample, but that didnt change the window of segmentation<br />> (meaning it always segments my whole file, giving me 'empty' segments).<br />><br />> Does anybody know how to solve this?<br />><br />> Thanks for your time,<br />><br />> Boukje Habets<br />><br />> --<br />><br />> Dr. Boukje Habets<br />> Biopsychology & Cognitive Neuroscience (AE14)<br />> Faculty of Psychology and Sports Science | Bielefeld University<br />> PO-Box 100131 | D-33501 Bielefeld, Germany<br />> Phone: (49) 521 - 106 67 533 |  Fax:   (49) 521 - 106 15 67 530<br />> Office: UHG T3-250<br />> ----------------------------------------------------------------<br />> _______________________________________________<br />> fieldtrip mailing list<br />> fieldtrip@donders.ru.nl<br />> <a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="l">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br />><br />-------------- next part --------------<br />An HTML attachment was scrubbed...<br />URL: <<a href="http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20171205/121398ca/attachment-0001.html" target="l">http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20171205/121398ca/attachment-0001.html</a>><br /><br />------------------------------<br /><br />Message: 3<br />Date: Tue, 5 Dec 2017 10:57:33 +0000<br />From: "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen@donders.ru.nl><br />To: FieldTrip discussion list <fieldtrip@science.ru.nl><br />Subject: Re: [FieldTrip] Question about segmentation<br />Message-ID: <851A8ED2-B8C9-4889-A997-F34090596BE5@donders.ru.nl><br />Content-Type: text/plain; charset="utf-8"<br /><br />Dear Boukje,<br /><br />I don?t think that ?adding a trigger? is necessary. <br /><br />Instead, I think you should be able to do something like this:<br /><br />start_idx = X*fsample;<br />end_idx = Y*fsample;<br /><br />(X and Y are the intended start and end points of the data, in seconds relative to the onset of the data recording, fsample is the sampling frequency in Hz)<br /><br />cfg = [];<br />cfg.datafile = ?the-name-of-your-datafile?;<br />cfg.trl = [start_idx end_idx 0];<br />cfg = ? (some other optional parameters to be defined here)<br />data =ft_preprocessing(cfg);<br /><br />cfg = [];<br />cfg.length = 2;<br />data_segmented = ft_redefinetrial(cfg, data);<br /><br />best wishes,<br />Jan-Mathijs<br /><br /><br />J.M.Schoffelen, MD PhD<br />Senior Researcher, VIDI-fellow - PI, language in interaction<br />Telephone: +31-24-3614793<br />Physical location: room 00.028<br />Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands<br /><br /><br /><br /><br /><br /><br /><br />> On 5 Dec 2017, at 10:55, Boukje Habets <boukje.habets@uni-bielefeld.de> wrote:<br />> <br />> Dear Fieldtrippers,<br />> <br />> Im new to Fieldtrip and have a question about segmentation. I want to do a freqanalysis on EEG data (Brainvision Recorder).<br />> I have one file per condition (so only containing one trigger code, and a start code at the beginning of the file) that i want to segment into 2sec pieces. Ive been trying to find a way to add a trigger with Fieldtrip, so that I can segment around a new trigger. Using a pre- and poststim timewindow around the trigger code is not a solution, as this gives me overlapping segments, which i do not want. <br />> This doesnt seem possible?<br />> <br />> After reading about cfg.trialfun, I saw that i can segment a continuous file into segments that i can define in terms of length (sec/samples). I guess this is the easiest way for me to segment my file. However, i want to be able to define the start and end point of segmentation, as my file contains a part in the beginning without codes (EEG was being recorded, but experiment was running yet). I have been playing around with the commands begsample and endsample, but that didnt change the window of segmentation (meaning it always segments my whole file, giving me 'empty' segments).<br />> <br />> Does anybody know how to solve this?<br />> <br />> Thanks for your time,<br />> <br />> Boukje Habets<br />> <br />> -- <br />> <br />> Dr. Boukje Habets<br />> Biopsychology & Cognitive Neuroscience (AE14)<br />> Faculty of Psychology and Sports Science | Bielefeld University<br />> PO-Box 100131 | D-33501 Bielefeld, Germany<br />> Phone: (49) 521 - 106 67 533 |  Fax:   (49) 521 - 106 15 67 530<br />> Office: UHG T3-250<br />> ---------------------------------------------------------------- _______________________________________________<br />> fieldtrip mailing list<br />> fieldtrip@donders.ru.nl<br />> <a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="l">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br /><br /><br /><br /><br /><br />------------------------------<br /><br />_______________________________________________<br />fieldtrip mailing list<br />fieldtrip@donders.ru.nl<br /><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="l">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br /><br />End of fieldtrip Digest, Vol 85, Issue 3<br />****************************************<br /></div></blockquote>-- <br signature="separator" /><br />Dr. Boukje Habets<br />Biopsychology & Cognitive Neuroscience (AE14)<br />Faculty of Psychology and Sports Science | Bielefeld University<br />PO-Box 100131 | D-33501 Bielefeld, Germany<br />Phone: (49) 521 - 106 67 533  |  Fax:   (49) 521 - 106 15 67 530<br />Office: UHG T3-250<br />----------------------------------------------------------------