sccn / eeglab

EEGLAB is an open source signal processing environment for electrophysiological signals running on Matlab and developed at the SCCN/UCSD
https://eeglab.ucsd.edu/
Other
594 stars 240 forks source link

Reject ICA components #759

Closed IsaacEGI closed 6 months ago

IsaacEGI commented 6 months ago

Description

Incorrect dimensions for matrix multiplication for some EEG data files when trying to reject components from the dataset using pop_subcom().


Steps to Reproduce

EEGout = pop_runica(EEGout, 'extended',1,'interupt','off');
% Automatically rejects components based off of the ICA
EEGout=iclabel(EEGout);
d = EEGout.etc.ic_classification.ICLabel.classifications(:,1)>0.1;
rej = zeros(size(EEGout.icawinv,2),1); rej(d)=1; rej = find(rej==0);
% pop_selectcomps(EEG,1:128); pause; close all
EEGout = pop_subcomp(EEGout, rej, 0);


Expected behavior:

EEG output data without the rejected components.


Actual behavior:

The following error message: Error using Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To operate on each element of the matrix individually, use TIMES (.) for elementwise multiplication. Error in pop_subcomp (line 175) compproj = EEG.icawinv(:, component_keep)*eeg_getdatact(EEG, 'component', component_keep, 'reshape', '2d'); Error in final_last_script (line 110) EEGout = pop_subcomp(EEGout, rej, 0);


Versions

OS version [fill in]
Matlab version [fill in]
EEGLAB version [fill in]
arnodelorme commented 6 months ago

The script works for me (and I guess for you on some datasets). I have looked at the code, it seems you are getting this error because d is empty.