EEG实验后统一两种不同的脑电帽的电极点数据

在不同设备或者使用了不同种帽子,可能会造成电极点数据顺序不一样,这里提供了一个自己编写的一个脚本,用来统一两种不同帽子的顺序,其中两个帽子的电极点需要自行修改,实现环境为matlab2013+eeglab13

% Written By  Yizhou 代码仅供参考,谨慎使用
% Using the code without proper understanding the code and relevant background
% of EEG may lead to confusion, incorrect data analyses,or misinterpretations
% of results.
% The author assumes NO responsibility for inappropriate or incorrect use
% of this code.
% WX:         17373158786
clear all;clc;
%转码前所在目录
filepath = '/Users/afterschoolboy/Documents/Eeg_data/reEEG/anal_Beta/Open/jingxitai_c/Pre_batch5_Epoched';
cd(filepath);
%转码后的文件夹
tran_code_path = '/Users/afterschoolboy/Documents/Eeg_data/reEEG/anal_Beta_gather/Open/control'
fre_file = dir([filepath,filesep,'*c.set']);
%转码的示例文件
EEG_K = pop_loadset('filename','New_RICAR_Sub_01_jingxitai.set','filepath',tran_code_path);
%两批数据的电极点顺序(小写统一成大写)
K = {'FP1';'FPZ';'FP2';'AF3';'AF4';'F7';'F5';'F3';'F1';'FZ';'F2';'F4';'F6';'F8';'FT7';'FC5';'FC3';'FC1';'FCZ';'FC2';'FC4';'FC6';'FT8';'T7';'C5';'C3';'C1';'CZ';'C2';'C4';'C6';'T8';'TP7';'CP5';'CP3';'CP1';'CPZ';'CP2';'CP4';'CP6';'TP8';'P7';'P5';'P3';'P1';'PZ';'P2';'P4';'P6';'P8';'PO7';'PO5';'PO3';'POZ';'PO4';'PO6';'PO8';'O1';'OZ';'O2'};
S = {'FP1';'FPZ';'FP2';'F7';'F3';'FZ';'F4';'F8';'FC5';'FC1';'FC2';'FC6';'T7';'C3';'CZ';'C4';'T8';'CP5';'CP1';'CP2';'CP6';'P7';'P3';'PZ';'P4';'P8';'POZ';'O1';'O2';'CPZ';'AF3';'AF4';'F5';'F1';'F2';'F6';'FC3';'FCZ';'FC4';'C5';'C1';'C2';'C6';'CP3';'CP4';'P5';'P1';'P2';'P6';'PO5';'PO3';'PO4';'PO6';'FT7';'FT8';'TP7';'TP8';'PO7';'PO8';'OZ'};

for i = 1:length(fre_file)
    fre_name = fre_file(i).name;
    EEG = pop_loadset('filename',fre_name,'filepath',filepath);
    EEG_data_ori = EEG.data;
    for s = 1:60
      j=find(strcmp(S, char(K(s)))); %找到每个电极点在新文件里面的电极点编号 
      new_Data(s,:,:) = EEG_data_ori(j,:,:);
    end
    %下面是将整理好的新序列的数据赋值给旧的文件
    EEG.data = new_Data;
    EEG.chanlocs = EEG_K.chanlocs;
    EEG.nbchan = EEG_K.nbchan;
    new_name = ['S2K_RICAR_Sub_',num2str(i,'%02d'),'_','jingxitai.set'];
    %保存到转码后的目录下
    EEG = pop_saveset( EEG, 'filename',new_name,'filepath',tran_code_path);
    clear EEG_data_ori;
    clear new_Data;
end
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值