<div dir="ltr"><div><div>I have encountered a behavior with ft_timelockgrandaverage that seems to me to be a bug, but I'm not quite sure. Hence why I am asking here and not just filing a bug. I'm using the attached .mat, and you can replicate the behavior with:<br>
<br> cfg = [];<br> cfg.channel = 'all'; <br> cfg.keepindividual = 'no';<br> cfg.method = 'within'; <br><br></div>out_data = ft_timelockgrandaverage(cfg,Dstruct.on.MSITOnset.global.x{:});<br>
<br><br></div>This will crash due to an array dimension mismatch. It does so because my different subjects/blocks in x{:} have different numbers of samples. Up around line 147, the ft_ function goes through varargin{:} and cuts down the averaged variable (in my case, 'avg') so that it has the same number of samples in each of the varargin{:} data structures.<br>
<div><div>The thing that I feel is a bug: it cuts the data, (expressed as varargin{i}.(cfg.parameter) ), but it does NOT similarly cut the variance ( varargin{i}.var ) or the per-timepoint DOF ( varargin{i}.dof ). As a result, when it gets to line 193 and tries to do<br>
<br> avgmat(s, :, :) = varargin{s}.(cfg.parameter).*varargin{s}.dof;<br><br></div><div>the (cfg.parameter) and dof matrices are now of different sizes, and we crash.<br><br></div><div>I can add my desired behavior to a local copy of the function and keep working, but would appreciate some advice on whether this is actually a bug, or somehow a design feature that I've failed to understand.<br>
</div><div><br><br clear="all"><div><div><div><div dir="ltr">Alik Widge<br><a href="mailto:alik.widge@gmail.com" target="_blank">alik.widge@gmail.com</a><br>(206) 866-5435<br><br></div></div>
</div></div></div></div></div>