olafdimigen/eye-eeg

compatibility of overweightevents.m with newer pop_rmbase

Closed this issue · 1 comments

In line 101 of overweightevents.m eeglab's pop_rmbase.m is called with two input arguments (i.e., pop_rmbase(sac, []). This worked fine when used with older eeglab versions. With Matlab 2019b and eeglab2019.1, it throws the following error:

Not enough input arguments.
Error in pop_rmbase (line 165)
elseif ~isempty(pointrange)
Error in overweightevents (line 101)
    sac = pop_rmbase(sac,[]); % baseline subtracted across whole epoch
Error in pop_overweightevents (line 86)
    [EEG_overweighted] = overweightevents(EEG,event2overweight,timelim,ow_proportion,removemean);

I think the error is due to recent changes in pop_rmbase. Adding a third, empty, input argument seems to solve the problem: pop_rmbase(sac, [], [])

This third argument shouldn't make a difference. See pop_rmbase's documentation:

Baseline points vector (overwritten by timerange).
% Empty or [] input -> Use whole epoch as baseline

Thanks, fixed!
(This change in EEGLAB 2019 will crash many scripts around the world and it can only be an oversight/accident that they did not make this backward-compatible and the third input optional)