<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Tony<div class=""><br class=""></div><div class="">Here’s a pretty quick and dirty fix - have a careful look to make sure it does what you want. You need FieldTrip installed and in the path; it works on my MATLAB2016a. Others on the list might have better ideas, or spot obvious errors.</div><div class=""><br class=""></div><div class="">Good luck</div><div class="">eugenio</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(37, 153, 45);" class="">% Import you data</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(178, 69, 243);" class=""><span style="color: #000000" class="">D = importdata(</span>'Pressure_3_6.txt'<span style="color: #000000" class="">,</span>' '<span style="color: #000000" class="">);</span></div><p style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(37, 153, 45);" class="">% Fill in FieldTrip data structure (check out ft_datatype_raw)</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(37, 153, 45);" class="">% I assume columns 4, 5 are EEG, 6,7 EMG.</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(37, 153, 45);" class="">% Channels go in rows, time in columns.</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;" class="">data = struct();</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(178, 69, 243);" class=""><span style="color: #000000" class="">data.label = {</span>'EEG-1'<span style="color: #000000" class="">;</span>'EEG-2'<span style="color: #000000" class="">;</span>'EMG-1'<span style="color: #000000" class="">;</span>'EMG-2'<span style="color: #000000" class="">};</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;" class="">data.fsample = 250;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;" class="">data.time  = {1:length(D)};</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;" class="">data.trial = {D(:,4:7)’};</div><p style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(37, 153, 45);" class="">% Check out how it looks</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;" class="">cfg = [];</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;" class="">cfg.viemode = <span style="color: #b245f3" class="">'vertical'</span>;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Courier;" class="">ft_databrowser(cfg,data);</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div><div class="">On 29 Nov 2018, at 17:22, Hoang Truong <<a href="mailto:Hoang.Truong@colorado.edu" class="">Hoang.Truong@colorado.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Dear community,<div class=""><br class=""></div><div class="">This is Tony, from CS Department, University of Colorado Boulder. I am new to eeg analysis and fieldtrip. Currently I work on recording eeg and emg data using our own hardware with 2 eeg and 2 emg channels respectively. </div><div class="">Since we use our custom hardware, the data are saved in a simple format of txt file with 7 columns (example data on Dropbox: <a href="https://www.dropbox.com/s/30yzafa7ukg8xhl/Pressure_3_6.txt?dl=0" class="">link</a>): 3 first columns are data from environment sensors, the next 4 are eeg and emg data (250Hz sampling rate, 42s recording)</div><div class="">I would like to ask what will be a proper way for me to import this data into fieldtrip. I checked the faq about importing custom data but I do not understand how to make custom readheader, readdata and readevent function.</div><div class="">Any help would be appreciated (suggestions, code examples, etc).</div><div class="">Thank you so much.</div><div class=""><br class=""></div><div class="">Sincerely,</div><div class="">Tony</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://doi.org/10.1371/journal.pcbi.1002202<br class=""></div></div><br class=""></div></body></html>