Back to the main page.
Bug 2528 - ft_math problem with .avg in timelock data
Status | ASSIGNED |
Reported | 2014-04-08 14:53:00 +0200 |
Modified | 2014-04-08 22:35:19 +0200 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Linux |
Importance: | P5 normal |
Assigned to: | Robert Oostenveld |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: | http://bugzilla.fcdonders.nl/show_bug.cgi?id=2185 |
Johanna - 2014-04-08 14:53:52 +0200
I see related bug 2051 (now closed). My data is timelock with keeptrials='yes' and it also has .avg field. I want to call ft_math as such: cfg=[]; cfg.operation='subtract'; cfg.parameter='avg'; data1_data2=ft_math(cfg,data1,data2); I first received an error due to not finding .avg field. This is because it was removed by ft_selectdata (line 99). But then I realised I was on FT version r9293, and so did an SVN update to current (r9378). Now I get an error within ft_selectdata_new (called by ft_math line 99) My input looks like: data1 = avg: [63x2000 double] var: [63x2000 double] time: [1x2000 double] dof: [63x2000 double] label: {63x1 cell} trial: [42x63x2000 double] dimord: 'rpt_chan_time' trialinfo: [42x5 double] cfg: [1x1 struct] The error now is: Index exceeds matrix dimensions. Error in ft_selectdata_new>cellmatselect (line 1323) x = x(:,:,selindx,:,:,:); Error in ft_selectdata_new>makeselection (line 670) data.(datfields{i}) = cellmatselect(data.(datfields{i}), seldim, selindx); Error in ft_selectdata_new (line 385) varargin{i} = makeselection(varargin{i}, find(strcmp(dimtok,'time')), seltime{i}, avgovertime, datfields, cfg.select); Error in ft_selectdata (line 51) [varargout{1:nargout}] = ft_selectdata_new(varargin{:}); Error in ft_math (line 99) [varargin{:}] = ft_selectdata(tmpcfg, varargin{:});
Johanna - 2014-04-08 14:59:31 +0200
An easy workaround is below, but just wondering if this is something that should be fixed. cfg=[]; cfg.operation='subtract'; cfg.parameter='avg'; data1_data2=ft_math(cfg,ft_timelockanalysis([],data1),ft_timelockanalysis([],data2));