<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="">
Dear Yannick,
<div class=""><br class="">
</div>
<div class="">In general, FieldTrip has a data2bids function, which might already provide you with an avenue to achieve what you want. There is quite a lot of documentation on the fieldtrip website, so with a targeted search I am sure you can find a lot of
 information that can get you further.</div>
<div class=""><br class="">
</div>
<div class="">Specific to the error that you got, however, the cause of it is a ‘hard coded’ error message on line 737 of ft_write_data. That is: the function does not support the writing of events in EDF-format, which typically is in the form of an annotation
 channel in de data file. </div>
<div class=""><br class="">
</div>
<div class="">BIDS, on the other hand, typically has events stored in an <some-name>_events.tsv file, where <some-name> has the same name as the dataset. So in your case, I’d look for a way to write a fieldtrip event structure to a tsv file, rather than adding
 the EVENT structure as an input to ft_write_data. There is functionality in fieldtrip that can help you on your way (again, see data2bids documentation + references therein).</div>
<div class=""><br class="">
</div>
<div class="">Good luck, and keep up the good work,</div>
<div class=""><br class="">
</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 9 Mar 2022, at 17:28, LONGUET Yannick 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="">
<div style="margin: 0cm; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">Dear community,</span></div>
<div style="margin: 0cm; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">My name is Yannick Longuet and I am a master 2 student, working in<b class=""> ICM
</b>(Paris Brain institute) in Paris on Human intracranial-EEG data. </span></div>
<div style="margin: 0cm; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class=""><br class="">
</span></div>
<div style="margin: 0cm; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">I would like my dataset to follow the BIDS specification but my iEEG data are stored in</span> the
<b class="">Poly5</b> format (TMSI). That's why I am looking to convert my i-EEG data in the
<b class="">European Data Format</b> (EDF) </div>
<div style="margin: 0cm; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class=""><br class="">
</span></div>
<div style="margin: 0cm; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class="">I've been trying to use the ft_write_data() function for the conversion for several days but without success. </span></div>
<div style="margin: 0cm; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class=""><span class="gmail-Apple-converted-space"><br class="">
</span></span></div>
<div style="margin: 0cm; font-family: Calibri, sans-serif;" class=""><span lang="EN-US" class=""><span class="gmail-Apple-converted-space"><b class=""> Here is my code : </b></span></span></div>
<div class="gmail-language-matlab gmail-highlighter-rouge" style="box-sizing:border-box;color:rgb(12,84,96);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";background-color:rgb(209,236,241)">
<div class="gmail-highlight" style="box-sizing:border-box;background-color:rgb(240,240,240);padding:0.8em;border-top-left-radius:0.3em;border-top-right-radius:0.3em;border-bottom-right-radius:0.3em;border-bottom-left-radius:0.3em;margin-bottom:0.5rem">
<pre class="gmail-highlight" style="box-sizing:border-box;font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;margin-top:0px;margin-bottom:0px;overflow:auto;color:rgb(33,37,41)"><code style="box-sizing:border-box;font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;color:inherit;word-break:normal" class=""><div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">filename_data=<span style="color:rgb(170,4,249)" class="">'RUN01.Poly5'</span></div><div style="font-size: 10px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier; color: rgb(170, 4, 249); min-height: 12px;" class=""><br class=""></div><div style="font-size: 10px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class="">cfg = [];</div><div style="font-size: 10px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class="">cfg.dataset = filename_data;</div><div style="font-size: 10px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class="">cfg.continuous = <span style="color:rgb(170,4,249)" class="">'yes'</span>;</div><div style="font-size: 10px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class="">cfg.chanel = <span style="color:rgb(170,4,249)" class="">'all';</span></div><div style="font-size: 10px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class="">data_unfilt<span class="gmail-Apple-converted-space">  </span>= ft_preprocessing(cfg);</div><div style="font-size: 10px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier;" class="">DATA=data_unfilt.trial;</div><div style="font-size: 12px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier; min-height: 14px;" class=""><span style="font-size:10px;color:inherit" class="">HEADER=ft_read_header(filename_data);</span><span class="gmail-Apple-converted-space" style="font-size:10px;color:inherit"> </span><br class=""></div><div style="font-size: 12px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier; min-height: 14px;" class=""><span style="font-size:10px;color:inherit" class="">EVENT=ft_read_event(filename_data)</span><br class=""></div><p style="font-size:12px;margin:0px;font-stretch:normal;line-height:normal;font-family:Courier;min-height:14px" class="">
<br class="webkit-block-placeholder"></p><div style="font-size: 10px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier; color: rgb(170, 4, 249);" class=""><span style="" class="">ft_write_data(</span>'Youyfu.edf'<span style="" class="">, DATA,</span>'header'<span style="" class="">,HEADER,</span>'event'<span style="" class="">,EVENT,</span>'dataformat'<span style="" class="">,</span>'edf'<span style="" class="">)</span></div><p style="font-size:12px;margin:0px;font-stretch:normal;line-height:normal;font-family:Courier;min-height:14px" class=""><br class="webkit-block-placeholder"></p></code></pre>
</div>
</div>
<div class=""><b class="">And here is the error message : </b></div>
<div class="">
<pre class="gmail-highlight" style="background-color:rgb(240,240,240);box-sizing:border-box;font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;margin-top:0px;margin-bottom:0px;overflow:auto"><code style="box-sizing:border-box;font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;word-break:normal" class=""><div style="color: inherit; margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class=""><br class=""></div><div style="font-size: 10px; margin: 0px; font-stretch: normal; line-height: normal; font-family: Courier; min-height: 12px;" class=""><font color="#666666" class="">EVENT = <br class=""><br class="">  1×252 struct array with fields:<br class=""><br class="">    type<br class="">    sample<br class="">    value<br class="">    offset<br class="">    duration</font><font color="#aa04f9" class=""><br class=""><br class=""></font><font color="#ff0000" class="">Error using ft_write_data (line 740)<br class="">writing events is not supported</font><font color="#aa04f9" class=""><br class=""></font></div></code></pre>
</div>
<div class=""><br class="">
</div>
<div class="">Do you have any idea what could be causing the problem?</div>
<div class="">Any help would be appreciated. </div>
<div class=""><br class="">
</div>
<div class="">Best regards </div>
<div class=""><br class="">
</div>
<div class="">Yannick </div>
<div class=""><br class="">
</div>
</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!_oEKUTWsK_tD30q4LeWIJh28nlL5NfhwXDGJO-aUVivQkkkMedlReE-NeLzXBDiuEedVEg9LXW2UOlyQroAmNW8SJWIwlwUVA_XP0Q$
<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>