[Eeglablist] error running ICA
Antonella Rosmino
antonella.rosmino at unicampania.it
Mon Sep 22 11:11:08 PDT 2025
Good evening, everyone,
I encounter this data processing block when running ICA.
Since I am not very familiar with this part, I will try to write a piece of code directly and the errors generated in the command window.
I don't know if any of you can give me any suggestions. To be honest, I tried relying on chatGPt a little, but obviously it didn't work.
Thank you for your attention.
Have a good evening,
Antonella R.
Piece of code:
% ICA
EEG = pop_runica(EEG, 'chanind', [1:60]);
EEG = eeg_checkset(EEG);
%EEG = pop_chanedit(EEG, 'load', {loc_file, 'filetype', 'autodetect'});
%EEG = pop_resample(EEG, 128); % Riduci la frequenza a 128 Hz
EEG = eeg_checkset(EEG);
% % Classifica i componenti ICA con ICLabel
% parpool;
if isempty(EEG.icaweights) || isempty(EEG.icasphere)
error('ICA non è stato eseguito! Devi eseguire ICA prima di usare ICLabel.');
end
EEG.chanlocs = EEG.chanlocs(1:60);
EEG.nbchan = 60;
reshaped_data = reshape(EEG.data(EEG.icachansind,:,:), length(EEG.icachansind), EEG.trials * EEG.pnts);
EEG.data=EEG.data(1:60,:);
EEG = pop_iclabel(EEG, 'default');
EEG = eeg_checkset(EEG);
%
% % Identifica componenti muscle o eye blinks con probabilità > 98%
comp2remove = find(EEG.etc.ic_classification.ICLabel.classifications(:, 3) > 0.95 | ...
EEG.etc.ic_classification.ICLabel.classifications(:, 2) > 0.95 | ...
EEG.etc.ic_classification.ICLabel.classifications(:, 4) > 0.95 | ...
EEG.etc.ic_classification.ICLabel.classifications(:, 5) > 0.95);
% % Rimuove i componenti identificati
if ~isempty(comp2remove)
EEG = pop_subcomp(EEG, comp2remove, 0);
EEG = eeg_checkset(EEG);
fprintf('Rimossi componenti ICA classificati come muscle o eye blinks');
else
fprintf('Nessun componente ICA rimosso');
end
Errors generated in the command window:
Recomputing ICA activations
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 eeg_getica (line 60)
icaact = (EEG.icaweights(comp,:)*EEG.icasphere)*reshape(EEG.data(EEG.icachansind,:,:), length(EEG.icachansind), EEG.trials*EEG.pnts);
^
Error in ICL_feature_extractor (line 21)
EEG.icaact = eeg_getica(EEG);
^^^^^^^^^^^^^^^
Error in iclabel (line 56)
features = ICL_feature_extractor(EEG, flag_autocorr);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in pop_iclabel (line 109)
EEG = iclabel(EEG, icversion);
^^^^^^^^^^^^^^^^^^^^^^^
Error in Dati_Antonella2 (line 75)
EEG = pop_iclabel(EEG); %aggiunto da me antonella 220925
^^^^^^^^^^^^^^^^
Related documentation
More information about the eeglablist
mailing list