Back to the main page.

Bug 2224 - cfg.previous fails for ft_selectdata

Status CLOSED FIXED
Reported 2013-07-30 15:46:00 +0200
Modified 2014-01-15 14:44:59 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks: 1021
See also:

Robert Oostenveld - 2013-07-30 15:46:52 +0200

Somehow the previous field is combined in the first argument and not spread over all arguments: freq1 = []; freq1.dimord = 'chan_freq'; freq1.freq = 1:10; freq1.label = {'1', '2', '3'}; freq1.powspctrm = randn(3,10); freq1.powspctrm(1) = 1; freq1.cfg.v = 1; freq2 = []; freq2.dimord = 'chan_freq'; freq2.freq = 1:10; freq2.label = {'1', '2', '3'}; freq2.powspctrm = randn(3,10); freq2.powspctrm(1) = 2; freq2.cfg.v = 2; >> [f1, f2] = ft_selectdata([], freq1, freq2) the call to "ft_selectdata_new" took 0 seconds and required the additional allocation of an estimated 0 MB f1 = dimord: 'chan_freq' freq: [1 2 3 4 5 6 7 8 9 10] label: {'1' '2' '3'} powspctrm: [3x10 double] cfg: [1x1 struct] f2 = dimord: 'chan_freq' freq: [1 2 3 4 5 6 7 8 9 10] label: {'1' '2' '3'} powspctrm: [3x10 double] cfg: [1x1 struct] >> f1.cfg.previous ans = [1x1 struct] [1x1 struct] >> f2.cfg.previous Reference to non-existent field 'previous'.


Robert Oostenveld - 2013-07-30 15:50:41 +0200

I added a (failing) test script: mac001> svn commit test/test_bug2224.m Adding test/test_bug2224.m Transmitting file data . Committed revision 8352.


Jan-Mathijs Schoffelen - 2013-11-27 15:25:48 +0100

Issue confirmed. Yet, it seems to go wrong in the postamble. ft_postamble_previous's default behavior is to pool the cfgs of the input arguments into a cell-array of cfg.previous. In the case of multiple output arguments, where each of the outputs map onto one of the inputs this is not meant to be.


Jan-Mathijs Schoffelen - 2013-11-27 15:32:27 +0100

I don't think we need to aim for a general solution in ft_postamble_previous (and ft_postamble_history), currently I would suggest to solve it locally in ft_selectdata_new, i.e. for k = 1:numel(varargout) varargout{k}.cfg = cfg; varargout{k}.cfg.previous = varargin{k}.cfg; end


Jan-Mathijs Schoffelen - 2013-11-27 15:36:30 +0100

bash-4.1$ svn commit -m "bugfix - (bug 2242) append each input argument's cfg to each output argument's cfg.previous" utilities/ft_selectdata_new.m Sending utilities/ft_selectdata_new.m Transmitting file data . Committed revision 8871.