Hi Vlad,
Thanks for the edit to the spm_eeg_grandmean function.
However, there still appears to be a bug which occurs when there is only a single condition (i.e. Ntypes=1) e.g. the case when all conditions have been combined into one in order to show overall activity above baseline. This bug affects both the new version (v6257) and the older one in the latest release (v5704).
Row 344 of v6257 says:
Do = badchannels(Do, ':', ~any(w'))
where w is an nchannels x Ntypes matrix showing the number of values contributing to the average for that channel/condition combination. Only good channels contribute, so if none of the input files have that channel as good, the value will be zero. This line of code is then supposed to flag these channels as bad in the new grandmean file.
But although ~any(w’) will generally output a 1 x nchannels matrix, when Ntypes is 1 the output is instead a single value (0 if there are any bad channels, 1 otherwise). This will incorrectly either mark no channels as bad when there is in fact a bad channel, or mark all channels as bad when there are none.
If you agree, the code will need to be amended to deal with this special case.
Thanks and regards,
Alex Billig
PhD student
MRC Cognition & Brain Sciences Unit
|