<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 Rachel,
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">load(’signal_raw.mat’); % I assume that this files contains the fieldtrip-style data structure</div>
<div class=""><br class="">
</div>
<div class="">cfg = [];</div>
<div class="">cfg.trl = trl;</div>
<div class="">data_epoched = ft_redefinetrial(cfg, data);</div>
<div class=""><br class="">
</div>
<div class="">So, note that ft_preprocessing shouldn’t be called, this is onlyl useable when reading proprietary data from disk.</div>
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">Best,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">On 15 Jul 2016, at 08:49, Nakyung Lee <<a href="mailto:rleese12@berkeley.edu" class="">rleese12@berkeley.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">Hi Arjen,</div>
<div class=""><br class="">
</div>
<div class="">Thank you for your reply.</div>
<div class="">Your email got forwarded successfully.</div>
<div class=""><br class="">
</div>
<div class="">So currently I tried using 'ft_definetrial' and 'ft_preprocessing'.</div>
<div class="">'ft_definetrial' returns an error when used with 'ft_trialfun' set to default.</div>
<div class="">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 class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class=""><font color="#0b5394" class="">cfg.dataset = 'signal_raw.mat';</font></div>
<div class=""><font color="#0b5394" class="">cfg.trialdef.event = subj_globals.buttonpress_times;</font></div>
<div class=""><font color="#0b5394" class="">cfg = ft_definetrial(cfg);</font></div>
<div class=""><br class="">
</div>
<div class="">So I simply call ft_definetrial with minimal configuration and here's the error I got:</div>
<div class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class="">
<div class=""><font color="#0b5394" class="">Error using ft_read_header (line 2194)</font></div>
<div class=""><font color="#0b5394" class="">unsupported header format "matlab"</font></div>
<div class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class=""><font color="#0b5394" class="">Error in ft_trialfun_general (line 78)</font></div>
<div class=""><font color="#0b5394" class="">hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat);</font></div>
<div class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class=""><font color="#0b5394" class="">Error in ft_definetrial (line 177)</font></div>
<div class=""><font color="#0b5394" class=""> [trl, event] = feval(cfg.trialfun, cfg);</font></div>
<div class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class=""><font color="#0b5394" class="">Error in trialdef_alsotest (line 12)</font></div>
<div class=""><font color="#0b5394" class="">cfg = ft_definetrial(cfg);</font></div>
</div>
<div class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class="">I circumvented this issue by using my own trialfun ('ft_trialfun_test' in the code).</div>
<div class="">We already have all the necessary timestamps so I could build a very simple one.<br class="">
</div>
<div class="">Here's a new code (I ran the code with minimal cfg for 'ft_preprocessing' to isolate the problem):</div>
<div class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class="">
<div class=""><font color="#0b5394" class="">cfg.dataset = 'signal_raw.mat';</font></div>
<div class=""><font color="#0b5394" class="">cfg.trialfun = 'ft_trialfun_test'; </font></div>
<div class=""><font color="#0b5394" class="">cfg.trialdef.event = subj_globals.buttonpress_times;</font></div>
<div class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class=""><font color="#0b5394" class="">cfg = ft_definetrial(cfg);</font></div>
<div class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class=""><font color="#0b5394" class="">cfg.continuous = 'yes';</font></div>
<div class=""><font color="#0b5394" class="">buttonpress_hg = ft_preprocessing(cfg);</font></div>
</div>
<div class=""><br class="">
</div>
<div class="">And here's the error I got:</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><font color="#0b5394" class="">Error using ft_read_header (line 2194)</font></div>
<div class=""><font color="#0b5394" class="">unsupported header format "matlab"</font></div>
<div class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class=""><font color="#0b5394" class="">Error in ft_preprocessing (line 397)</font></div>
<div class=""><font color="#0b5394" class=""> hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat, 'coordsys', cfg.coordsys, 'coilaccuracy',</font></div>
<div class=""><font color="#0b5394" class=""> cfg.coilaccuracy);</font></div>
<div class=""><font color="#0b5394" class=""><br class="">
</font></div>
<div class=""><font color="#0b5394" class="">Error in test_trialdef (line 18)</font></div>
<div class=""><font color="#0b5394" class="">buttonpress_hg = ft_preprocessing(cfg);</font></div>
</div>
<div class=""><br class="">
</div>
<div class="">So both error come from 'ft_read_header'.</div>
<div class="">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 class="">Am I doing something wrong here?</div>
<div class=""><br class="">
</div>
<div class="">Again, thank you for your reply and let me know if you need more information.</div>
<div class=""><br class="">
</div>
<div class="">Best,</div>
<div class="">Rachel</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Thu, Jul 14, 2016 at 12:10 AM, Arjen Stolk <span dir="ltr" class="">
<<a href="mailto:a.stolk8@gmail.com" target="_blank" class="">a.stolk8@gmail.com</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Rachel,<br class="">
<br class="">
What is the error you're receiving, and how are you calling ft_preprocessing?<br class="">
<br class="">
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 class="">
cfg = []<br class="">
cfg ..<br class="">
data = ft_preprocessing(cfg, raw)<br class="">
<br class="">
where raw is your data as described above.<br class="">
<br class="">
Best,<br class="">
Arjen<br class="">
<div class="">
<div class="h5"><br class="">
> On Jul 13, 2016, at 11:50 PM, Nakyung Lee <<a href="mailto:rleese12@berkeley.edu" class="">rleese12@berkeley.edu</a>> wrote:<br class="">
><br class="">
> Dear FieldTrip community,<br class="">
><br class="">
> My name is Rachel Lee and I'm a research assistant in Prof. Ming Hsu's lab in UC Berkeley.<br class="">
><br class="">
> 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 class="">
> 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 class="">
> 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 class="">
> I've been looking at the codes but been unable to come up with a solution.<br class="">
><br class="">
> Does anyone have a similar experience?<br class="">
> Is there any way to circumvent this issue?<br class="">
> Any type of help would be appreciated.<br class="">
><br class="">
> Thank you,<br class="">
> Rachel Lee<br class="">
</div>
</div>
> _______________________________________________<br class="">
> fieldtrip mailing list<br class="">
> <a href="mailto:fieldtrip@donders.ru.nl" class="">fieldtrip@donders.ru.nl</a><br class="">
> <a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank" class="">
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
<br class="">
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="mailto:fieldtrip@donders.ru.nl" class="">fieldtrip@donders.ru.nl</a><br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
</blockquote>
</div>
<br class="">
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="mailto:fieldtrip@donders.ru.nl" class="">fieldtrip@donders.ru.nl</a><br class="">
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>