Back to the main page.
Bug 2589 - ft_selectdata detects second dimension of sampleinfo as channels
Status | CLOSED FIXED |
Reported | 2014-05-22 16:15:00 +0200 |
Modified | 2014-07-15 17:25:09 +0200 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Windows |
Importance: | P5 normal |
Assigned to: | Robert Oostenveld |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
- 2014-05-22 16:15:05 +0200
- 2014-05-22 16:17:21 +0200
In my 64 EEG channel data I extract 2 EOG channels of which I want to select one. When using ft_selectdata, it copies only 1 column of the sampleinfo, because it seems to assume that the 2 columns represent 2 channels (instead of the onset & offset sample numbers).
Robert Oostenveld - 2014-05-22 16:20:23 +0200
silly ft_selectdata!
Robert Oostenveld - 2014-05-22 16:26:10 +0200
Hi Lisa, I can confirm the problem you reported: data = []; for i=1:2 data.label{i} = num2str(i); end for i=1:7 data.trial{i} = randn(2,300); data.time{i} = (1:300)/300; end data.sampleinfo = randn(7, 2); % 7 trials, not 2 channels data.trialinfo = randn(7, 7); % 7 trials, 7 "triggers" cfg = []; cfg.channel = 1; output = ft_selectdata(cfg, data); assert(size(output.sampleinfo,1)==7); assert(size(output.sampleinfo,2)==2); % this fails
Robert Oostenveld - 2014-05-22 16:39:20 +0200
mac011> svn commit test/test_bug2589.m utilities/private/getdimord.m Adding test/test_bug2589.m Sending utilities/private/getdimord.m Transmitting file data .. Committed revision 9581. I solved the problem and made a small test script. I had to change the order in getdimord, i.e. first deal with known fields and only then become "smart". Furthermore, related to a change yesterday I also had to change rpt_unknown into rpt_other, otherwise the sampleinfo field would be stripped off by ft_selectdata. it will be on home/common in ~10 minutes