<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Great to hear!</div><div><br>On Jul 15, 2016, at 6:54 PM, Nakyung Lee <<a href="mailto:rleese12@berkeley.edu">rleese12@berkeley.edu</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hooray, it works!<div><span style="color:rgb(0,0,0)">Thanks for being patient with me :)</span><br><div><br></div><div><div><font color="#0b5394">>> cfg = [];</font></div><div><font color="#0b5394">>> cfg.demean = 'yes';</font></div><div><font color="#0b5394">>> data = signal_raw</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">data = </font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">      label: {176x1 cell}</font></div><div><font color="#0b5394">       time: {[1x721186 double]}</font></div><div><font color="#0b5394">      trial: {[176x721186 double]}</font></div><div><font color="#0b5394">    fsample: 1000</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">>> data2 = ft_preprocessing(cfg, data);</font></div></div><div><div><font color="#0b5394">Warning: discarding non-unique channel names </font></div><div><font color="#0b5394">> In ft_channelselection (line 102)</font></div><div><font color="#0b5394">  In ft_selectdata>getselection_chan (line 649)</font></div><div><font color="#0b5394">  In ft_selectdata (line 279)</font></div><div><font color="#0b5394">  In ft_preprocessing (line 317) </font></div><div><font color="#0b5394">the call to "ft_selectdata" took 2 seconds</font></div><div><font color="#0b5394">preprocessing</font></div><div><font color="#0b5394">preprocessing trial 1 from 1</font></div><div><font color="#0b5394"><br></font></div><div><font color="#0b5394">the call to "ft_preprocessing" took 4 seconds</font></div></div><div><font color="#0b5394"><br></font></div><div>And thanks again.</div></div><div><br></div><div>Best,</div><div>Rachel</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 15, 2016 at 10:47 AM, Arjen Stolk <span dir="ltr"><<a href="mailto:a.stolk8@gmail.com" target="_blank">a.stolk8@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Almost there, Rachel. :) Now ensure your data.label field contains strings and not numbers, i.e.<div><br></div><div>data.label = {'1';'2'} and not {1;2}</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2016-07-15 10:33 GMT-07:00 Nakyung Lee <span dir="ltr"><<a href="mailto:rleese12@berkeley.edu" target="_blank">rleese12@berkeley.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Arjen,<div><br></div><div>Yes, that is exactly the structure of 'signal_raw' I'm using.</div><div>I tried your code (without running 'ft_definetrial' beforehand) and here's the log:</div><div><font color="#444444"><br></font></div><div><span><div><font color="#444444">>> cfg = [];</font></div><div><font color="#444444">>> cfg.demean = 'yes';</font></div></span><div><font color="#444444">>> data = signal_raw</font></div><div><font color="#444444"><br></font></div></div><div><div><font color="#444444">data = </font></div><div><font color="#444444"><br></font></div><div><font color="#444444">      label: {176x1 cell}</font></div><div><font color="#444444">       time: {[1x721186 double]}</font></div><div><font color="#444444">      trial: {[176x721186 double]}</font></div><div><font color="#444444">    fsample: 1000</font></div><div><font color="#444444"><br></font></div><div><font color="#444444">>> data2 = ft_preprocessing(cfg, data);</font></div><div><font color="#bf9000">Warning: the data does not contain a trial definition </font></div><div><font color="#bf9000">> In ft_warning (line 184)</font></div><div><font color="#bf9000">  In fixsampleinfo (line 66)</font></div><div><font color="#bf9000">  In ft_datatype_raw (line 175)</font></div><div><font color="#bf9000">  In ft_checkdata (line 219)</font></div><div><font color="#bf9000">  In ft_preprocessing (line 274) </font></div><div><font color="#bf9000">Warning: reconstructing sampleinfo by assuming that the trials are consecutive segments of a continuous recording </font></div><div><font color="#bf9000">> In ft_warning (line 184)</font></div><div><font color="#bf9000">  In fixsampleinfo (line 79)</font></div><div><font color="#bf9000">  In ft_datatype_raw (line 175)</font></div><div><font color="#bf9000">  In ft_checkdata (line 219)</font></div><div><font color="#bf9000">  In ft_preprocessing (line 274) </font></div><div><font color="#990000">Error using cell/ismember (line 34)</font></div><div><font color="#990000">Input A of class cell and input B of class cell must be cell arrays of strings, unless one is a string.</font></div><div><font color="#990000"><br></font></div><div><font color="#990000">Error in ft_senstype (line 303)</font></div><div><font color="#990000">    if     (mean(ismember(ft_senslabel('ant128'),         sens.label)) > 0.8)</font></div><div><font color="#990000"><br></font></div><div><font color="#990000">Error in ft_channelselection (line 83)</font></div><div><font color="#990000">  senstype = ft_senstype(datachannel);</font></div><div><font color="#990000"><br></font></div><div><font color="#990000">Error in ft_selectdata>getselection_chan (line 649)</font></div><div><font color="#990000">  selchannel = ft_channelselection(cfg.channel, varargin{k}.label);</font></div><div><font color="#990000"><br></font></div><div><font color="#990000">Error in ft_selectdata (line 279)</font></div><div><font color="#990000">if haschan,    [selchan,    cfg] = getselection_chan   (cfg, varargin{:}, cfg.select); end</font></div><div><font color="#990000"><br></font></div><div><font color="#990000">Error in ft_preprocessing (line 317)</font></div><div><font color="#990000">  data   = ft_selectdata(tmpcfg, data);</font></div><div> </div></div><div>This data is not segmented yet so there's only one trial (and hence time: <font color="#0b5394">{[1x721186 double]}</font> and trial: <font color="#0b5394">{[176x721186 double]})</font><font color="#000000"> with 'Ntime' equal to '721186'.</font></div><div>There were warning signs but seems like those are ignore-able ones.</div><div>Again, let me know if you need more information and thank you.</div><div><br></div><div>Best,</div><div>Rachel</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 15, 2016 at 10:01 AM, Arjen Stolk <span dir="ltr"><<a href="mailto:a.stolk8@gmail.com" target="_blank">a.stolk8@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Rachel,<div><br></div><div>Given that you already have the data imported into matlab and organized into trials, try creating a structure 'data' with the following fields (i.e. data.label, data.time, data.trial) and the following dimensions:</div><div><br></div><div><pre style="white-space:pre-wrap;padding:0.5em;margin-top:0px;font-size:12px;border:1px dashed rgb(204,204,204);color:rgb(0,0,0);overflow:hidden;font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;background-color:rgb(247,249,250);width:640px;text-align:justify">label: {151x1 cell}      the channel labels (e.g. 'MRC13')
time: {1x266 cell}      the timeaxis [1*Ntime double] per trial
trial: {1x266 cell}      the numeric data [151*Ntime double] per trial</pre></div><div>Then, for a proof of principle, try:</div><div><br></div><div>cfg = [];</div><div>cfg.demean = 'yes';</div><div>data2 = ft_preprocessing(cfg, data);</div><div><br></div><div>Let us know if this worked for you.</div><span><font color="#888888"><div>Arjen<br></div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-15 9:51 GMT-07:00 Nakyung Lee <span dir="ltr"><<a href="mailto:rleese12@berkeley.edu" target="_blank">rleese12@berkeley.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Jan-Mathijs,<div><br></div><div>Thanks for your advice.</div><div>Yes, I used 'ft_=definetrial' to segment the data.</div><div>My data is in the fieldtrip style data format not because it's been segmented and preprocessed through fieldtrip but because our original dataformat is unsupported by fieldtrip (.Tbk, .Tdx, .tev, .tsq to be exact).</div><div>So my coworker transformed those data into a .mat file and I transformed into a fieldtrip style raw data but it still needs some segmenting and some other preprocessing done on it (for example high-gamma filtering).</div><div>But if 'ft_preprocessing'<span style="font-size:12.8px"> is only useable when reading proprietary data from disk, there's just no way we can preprocess the above data using fieldtrip?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thank you,</span></div><div><span style="font-size:12.8px">Rachel</span></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 15, 2016 at 1:10 AM, Schoffelen, J.M. (Jan Mathijs) <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">
Hi Rachel,
<div><br>
</div>
<div>Once your data is represented in a fieldtrip-style structure, there’s no need anymore to call ft_definetrial with a specified named dataset in the cfg.</div>
<div><br>
</div>
<div>If you want to segment your data, you may still want to call ft_definetrial to generate a so-called ‘trl’ matrix, and subsequently use ft_redefinetrial to re-segment, i.e.:</div>
<div><br>
</div>
<div>load(’signal_raw.mat’); % I assume that this files contains the fieldtrip-style data structure</div>
<div><br>
</div>
<div>cfg = [];</div>
<div>cfg.trl = trl;</div>
<div>data_epoched = ft_redefinetrial(cfg, data);</div>
<div><br>
</div>
<div>So, note that ft_preprocessing shouldn’t be called, this is onlyl useable when reading proprietary data from disk.</div>
<div><br>
</div>
<div>It seems that you don’t need the cfg.dataset argument to begin with, and if you manage to titrate your ft_trialfun_test such that it converts the timestamps you provide it with into the correct trl-matrix, I don’t see a reason why it shouldn’t
 work.</div>
<div><br>
</div>
<div>Best,</div>
<div>Jan-Mathijs</div><div><div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>
<blockquote type="cite">
<div>On 15 Jul 2016, at 08:49, Nakyung Lee <<a href="mailto:rleese12@berkeley.edu" target="_blank">rleese12@berkeley.edu</a>> wrote:</div>
<br>
<div>
<div dir="ltr">
<div>Hi Arjen,</div>
<div><br>
</div>
<div>Thank you for your reply.</div>
<div>Your email got forwarded successfully.</div>
<div><br>
</div>
<div>So currently I tried using 'ft_definetrial' and 'ft_preprocessing'.</div>
<div>'ft_definetrial' returns an error when used with 'ft_trialfun' set to default.</div>
<div>Below is the code I used (and 'signal_raw.mat' is a fieldtrip raw data and it has all three fields you mentioned).</div>
<div><font color="#0b5394"><br>
</font></div>
<div><font color="#0b5394">cfg.dataset = 'signal_raw.mat';</font></div>
<div><font color="#0b5394">cfg.trialdef.event = subj_globals.buttonpress_times;</font></div>
<div><font color="#0b5394">cfg = ft_definetrial(cfg);</font></div>
<div><br>
</div>
<div>So I simply call ft_definetrial with minimal configuration and here's the error I got:</div>
<div><font color="#0b5394"><br>
</font></div>
<div>
<div><font color="#0b5394">Error using ft_read_header (line 2194)</font></div>
<div><font color="#0b5394">unsupported header format "matlab"</font></div>
<div><font color="#0b5394"><br>
</font></div>
<div><font color="#0b5394">Error in ft_trialfun_general (line 78)</font></div>
<div><font color="#0b5394">hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat);</font></div>
<div><font color="#0b5394"><br>
</font></div>
<div><font color="#0b5394">Error in ft_definetrial (line 177)</font></div>
<div><font color="#0b5394">    [trl, event] = feval(cfg.trialfun, cfg);</font></div>
<div><font color="#0b5394"><br>
</font></div>
<div><font color="#0b5394">Error in trialdef_alsotest (line 12)</font></div>
<div><font color="#0b5394">cfg = ft_definetrial(cfg);</font></div>
</div>
<div><font color="#0b5394"><br>
</font></div>
<div>I circumvented this issue by using my own trialfun ('ft_trialfun_test' in the code).</div>
<div>We already have all the necessary timestamps so I could build a very simple one.<br>
</div>
<div>Here's a new code (I ran the code with minimal cfg for 'ft_preprocessing' to isolate the problem):</div>
<div><font color="#0b5394"><br>
</font></div>
<div>
<div><font color="#0b5394">cfg.dataset = 'signal_raw.mat';</font></div>
<div><font color="#0b5394">cfg.trialfun = 'ft_trialfun_test'; </font></div>
<div><font color="#0b5394">cfg.trialdef.event = subj_globals.buttonpress_times;</font></div>
<div><font color="#0b5394"><br>
</font></div>
<div><font color="#0b5394">cfg = ft_definetrial(cfg);</font></div>
<div><font color="#0b5394"><br>
</font></div>
<div><font color="#0b5394">cfg.continuous = 'yes';</font></div>
<div><font color="#0b5394">buttonpress_hg = ft_preprocessing(cfg);</font></div>
</div>
<div><br>
</div>
<div>And here's the error I got:</div>
<div><br>
</div>
<div>
<div><font color="#0b5394">Error using ft_read_header (line 2194)</font></div>
<div><font color="#0b5394">unsupported header format "matlab"</font></div>
<div><font color="#0b5394"><br>
</font></div>
<div><font color="#0b5394">Error in ft_preprocessing (line 397)</font></div>
<div><font color="#0b5394">  hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat, 'coordsys', cfg.coordsys, 'coilaccuracy',</font></div>
<div><font color="#0b5394">  cfg.coilaccuracy);</font></div>
<div><font color="#0b5394"><br>
</font></div>
<div><font color="#0b5394">Error in test_trialdef (line 18)</font></div>
<div><font color="#0b5394">buttonpress_hg = ft_preprocessing(cfg);</font></div>
</div>
<div><br>
</div>
<div>So both error come from 'ft_read_header'.</div>
<div>I've been looking at the code but it seemed quite hard to debug as 'ft_read_header' uses a lower level function that directly reads from the file (hence it seemed like a simple fix like passing in a fake header wouldn't work).</div>
<div>Am I doing something wrong here?</div>
<div><br>
</div>
<div>Again, thank you for your reply and let me know if you need more information.</div>
<div><br>
</div>
<div>Best,</div>
<div>Rachel</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Jul 14, 2016 at 12:10 AM, Arjen Stolk <span dir="ltr">
<<a href="mailto:a.stolk8@gmail.com" target="_blank">a.stolk8@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Rachel,<br>
<br>
What is the error you're receiving, and how are you calling ft_preprocessing?<br>
<br>
If the data is in raw format (incl a trial, time and label field), it should theoretically be possible to use ft_preprocessing on it, eg;<br>
cfg = []<br>
cfg ..<br>
data = ft_preprocessing(cfg, raw)<br>
<br>
where raw is your data as described above.<br>
<br>
Best,<br>
Arjen<br>
<div>
<div><br>
> On Jul 13, 2016, at 11:50 PM, Nakyung Lee <<a href="mailto:rleese12@berkeley.edu" target="_blank">rleese12@berkeley.edu</a>> wrote:<br>
><br>
> Dear FieldTrip community,<br>
><br>
> My name is Rachel Lee and I'm a research assistant in Prof. Ming Hsu's lab in UC Berkeley.<br>
><br>
> We currently have a .Tbk file, a .Tdx file, .tev file, .tsq file to preprocess and analyze but it seems like those data formats are not yet supported by FieldTrip.<br>
> So, instead of using those raw data files, we've been trying to find a workaround by transforming them into a .mat file (and casting the .mat file into a raw datatype in FieldTrip by manually assigning fields to it).<br>
> This hasn't been so successful; we've been unable to call ft_preprocessing because of the lack of a proper header format (which is needed in ft_read_header, one of the lower level functions that ft_preprocessing calls).<br>
> I've been looking at the codes but been unable to come up with a solution.<br>
><br>
> Does anyone have a similar experience?<br>
> Is there any way to circumvent this issue?<br>
> Any type of help would be appreciated.<br>
><br>
> Thank you,<br>
> Rachel Lee<br>
</div>
</div>
> _______________________________________________<br>
> fieldtrip mailing list<br>
> <a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
> <a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</blockquote>
</div>
<br>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br>
</div>
</div></div></div>

<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>fieldtrip mailing list</span><br><span><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a></span><br><span><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></span></div></blockquote></body></html>