Skip to content

ica

ica rejects independent components of the ICA currently loaded in AnyWave, or restores them. It does what you do by hand when you reject components in the ICA panel: AnyWave marks the components as rejected and rebuilds the signals.

anywave('ica', cfg);

Note

The command is called ica (not ica_command). The name ica_command belongs to the Python package.

field content required
labels cell array of the labels of the components yes
command 'reject' (default) or 'undo' no

The labels of the components start with the modality: E_IC1, E_IC2... for EEG, S_IC1... for sEEG, M_IC1... for MEG and EMG_IC1... for EMG. The numbering starts at 1.

Examples

Reject components 10 and 15 of a MEG ICA:

function main(varargin)
anywave('init', varargin);

cfg = [];
cfg.labels = {'M_IC10', 'M_IC15'};
cfg.command = 'reject';             % the default, you can leave it out
anywave('ica', cfg);
end

Restore them:

cfg = [];
cfg.labels = {'M_IC10', 'M_IC15'};
cfg.command = 'undo';
anywave('ica', cfg);

Build the list of labels in your code:

rejected = [1 4 7];                                 % numbers of the components
labels = arrayfun(@(k) sprintf('E_IC%d', k), rejected, 'UniformOutput', false);
anywave('ica', struct('labels', {labels}));         % {labels}: the list itself is the value of the field

Good to know

  • An ICA must be loaded in AnyWave. Without an ICA the command is accepted and nothing happens.

Errors

message cause
ERROR: labels key is not specified in struct/dict parameter. no labels field
ERROR: labels is empty. labels is an empty list
ERROR: command must be 'reject' or 'undo'. any other value for command