ucdavis / erplab

ERPLAB Toolbox is a free, open-source Matlab package for analyzing ERP data. It is tightly integrated with EEGLAB Toolbox, extending EEGLAB’s capabilities to provide robust, industrial-strength tools for ERP processing, visualization, and analysis. A graphical user interface makes it easy for beginners to learn, and Matlab scripting provides enormous power for intermediate and advanced users.
http://erpinfo.org/erplab
262 stars 75 forks source link

RMS aSME for gaverager() returns NANs if subjects have empty bin epochs #130

Open ghost opened 4 years ago

ghost commented 4 years ago

ERPLABV8: gaverager.m returns NaNs in the case that one of the subjects doesn't have epochs for one bin because of the line: 415- dq_rms = rms(dq_data_here,4);

Solved it with a different rms function that can omit NaNs: function out=rms2(A,varargin) out=sqrt(mean(A.^2,varargin{:})); end

and replacing the original line with: dq.data = rms2(dq_data_here,4,'omitnan');

andrewxstewart commented 4 years ago

Thanks for the comment. Yes, I think the omitting NaNs is sensible here.

Perhaps that should be the default behavior for gaverager.

I don't quite follow how that omitnan argument is having effect in rms2. Is there more to that function?