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
271 stars 73 forks source link

Bugfix: joinclosesegments.m #42

Open behinger opened 8 years ago

behinger commented 8 years ago

Disclaimer: I'm not using erplab in the regular way, but try to make use of the continuous artefact rejection function. In this case the error should occur always not specific to my usage. But then I don't know if erplab does something different somewhere.

In joinclosesegments.m the last line (104) is: WinRej2(end+1,:) = WinRej(end,:); % Save/append the last rejection window

This enhances the size of the output WinRej by one, but the ChanRej is not enhanced. Thus as called in _popcontinuousartefact.m

-[WinRej, chanrej ] = joinclosesegments(WinRej, chanrej, shortisisam);

subsequently the function crashes because in Line 413 it tries to do: matrixrej = [WinRej colormatrej chanrej]; which does not work if the matrices are of unequal size.

Proposed fix: Add another line to joinclosesegments.m thus that line 104 and new 105 now say: WinRej2(end+1,:) = WinRej(end,:); % Save/append the last rejection window ChanRej2(end+1,:) = chanrej(end,:); % Save/append the last rejection window

jasonarita commented 8 years ago

Thanks! I'm actually working on updating joinclosesegments for another function, so I'll definitely look into incorporating your proposed fix