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