【发布时间】:2017-07-17 14:57:42
【问题描述】:
我目前正在做一个关于 BCI 运动图像数据集的项目。我的兴趣是通过 ICA 方法提取必要的组件。我目前正在为此目的使用 EEGLAB。能否请您帮助我如何将自变量变量从 GUI 提取到 MATLAB 的工作区?
【问题讨论】:
我目前正在做一个关于 BCI 运动图像数据集的项目。我的兴趣是通过 ICA 方法提取必要的组件。我目前正在为此目的使用 EEGLAB。能否请您帮助我如何将自变量变量从 GUI 提取到 MATLAB 的工作区?
【问题讨论】:
在 eeglab 中对数据集运行 ICA 后,ICA 权重保存在 EEG 结构中的 icaweights 矩阵中(当您的数据加载到 eeglab 中时,您可以在工作区中看到 EEG 结构),以便转换icaweights 到您在plot>Component Activations 中看到的信号,假设这是您要提取的,请执行以下操作:
file>load existing dataset。选择要提取的组件并将它们保存为矢量。作为示例,我将选择组件 5 和 9:
comp_idx = [5 9]; %id of channels we extract
将通道数据(这里表示为Y)转换为ICA激活(Y_ICA)如下:
Y = EEG.data; % set channel data to matrix Y
ica_weights = EEG.icaweights; % copy icaweights matrix
Y_ICA = ica_weights*Y; % Component Activations
Y_ICA 现在包含所有组件激活,使用Y_ICA(comp_idx,:) 仅提取您需要的组件,您可以对这个新矩阵进行操作,例如对两个组件求和和绘图:
%% Mix components and plot
figure;
S = sum( Y_ICA(comp_idx,:) );
plot(EEG.times, S, 'r') % EEG.times contains the time data
title('Mix of all Channels')
或者单独绘制每个组件:
%% Plot each component
figure;
plot( EEG.times, Y_ICA(comp_idx(1),:))
hold on
plot( EEG.times, Y_ICA(comp_idx(2),:))
注意:如果您的数据由 epoch 组成,那么 EEG.data 矩阵将是一个三维矩阵,第 3 维是 epoch 集,因此您必须执行对于每个 epoch 的上述过程,即 Y = EEG.data(:,:,epoch_i) 并迭代 epoch_i = 1:size(EEG.data,3)
【讨论】:
我不确定 ReZzT 的回答是否完全正确。
查看 eeg_getdatact.m 文件
edit eeg_getdatact
可以看出,组件激活是通过额外的矩阵乘法计算的(使用 icasphere)。查看第 179-180 行:
data = eeg_getdatact( EEG );
data = (EEG.icaweights(opt.component,:)*EEG.icasphere)*data(EEG.icachansind,:);
其中,简化后,最后一行可以写成:
data = (EEG.icaweights*EEG.icasphere)*eegdata;
【讨论】: