Back to the main page.

Bug 2378 - ft_redefinetrial: does not seem to copy over the last columns of a trl matrix into data.trialinfo

Status CLOSED FIXED
Reported 2013-11-15 12:22:00 +0100
Modified 2018-03-10 21:34:45 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to:
URL:
Tags:
Depends on:
Blocks:
See also:

Jan-Mathijs Schoffelen - 2013-11-15 12:22:16 +0100

check and fix.


Jan-Mathijs Schoffelen - 2013-11-15 13:50:41 +0100

This is probably a false alarm: user was using an FT-version dated may 2012...


- 2013-11-19 19:21:49 +0100

I just tried this out with my own data on matlab2011b. The trialinfo field is missing. The code used is as follows. prestim =0.2, poststim = 0.5; filename = mous_db_getfilename(subjectname, 'meg_ds_task'); [trl] = mous_defineTrial(filename{1}, prestim, poststim, trialfun); trl = trl(1:10,:); cfg.dataset: filename; cfg.trl: [10x8 double] % trl = 8 columns, so trialinfo should have 5 columns cfg.continuous: 'yes' cfg.lpfilter: 'yes' cfg.lpfreq: 40; data = ft_preprocessing(cfg) cfg2 = []; cfg2.toilim = [0.2 0.4]; dataRD = ft_redefine(cfg,data); dataRD = hdr: [1x1 struct] label: {356x1 cell} time: {1x10 cell} trial: {1x10 cell} fsample: 1200 sampleinfo: [10x2 double] grad: [1x1 struct] cfg: [1x1 struct]


- 2013-11-19 19:30:02 +0100

oh, and just to be clear the 'trialinfo' field is present when using ft_definetrial.


- 2013-11-19 20:15:02 +0100

the code for creating data.trialinfo is located within the if-loop for <if ~isempty(cfg.trl)> when calling ft_redefinetrial(cfg,data). The start of this function has a <cfg.trl = ft_getopt(cfg, 'trl', [])>. So, by default cfg.trl = [] If the goal is to keep the code as similar as possible prior to change, and that we should reconstruct 'data' (as mentioned in the comment of line 208), then I think we should only change line 213 <trl = cfg.trl>. This line should read <trl = dataold.cfg.trl>; In this way: (1) when we get to line 236: if size(cfg.trl,2)>3 will apply, and then subsequent creation of data.trialinfo can take place. (2) the user does not have to explicitly make cfg.trl = data.trl, before calling ft_redefine(cfg,data), which is important because ft_redefinetrial can be used multiple ways, and cfg.trl need not always to be configured prior to calling ft_redefine. Could someone please check whether this is reasonable?


- 2013-11-19 20:40:31 +0100

Actually, maybe it's nothing after all. I double checked and the problem seems to be gone. I'll check tomorrow again...


- 2013-11-20 19:25:59 +0100

Sat down with JM - learned to go about this in a more logical way. Created a test_bug2378 to test if ft_redefinetrial was working. Everything is in order. Closing bug.


- 2013-11-20 19:27:22 +0100

Should be more clear: There was no problem in the bug to begin with. As suspected, the missing trialinfo was probably due to the user using and old FT-version.


Robert Oostenveld - 2014-04-11 19:22:46 +0200

I recently increased the memory of this one from 500mb to 1gb, causing the script to start running to the end. Subsequently it became clear that there was an error at the end of the script. The variable mytrl did not exist. I fixed it and tested it manually, all is fine now. roboos@mentat001> svn commit test_bug2378.m Sending test_bug2378.m Transmitting file data . Committed revision 9398.