给丢失marker的脑电数据补上marker,亡羊补牢虽未晚,防患未然更可贵,建议大家做实验之前还是要好好测试程序,不要出现数据采完了才发现没有marker的情况,示例代码演示的是一个等距离间隔的marker添加,大家按照自己的行为数据适当修改
% 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
eeglab; % 打开eeglab,一般在eeglab redraw之后建议都使用eeglab,以防出现 bug
EEG = pop_loadset('filename','F_0170_01.set','filepath','D:\\Docu\\Work\\1_Projects\\tim_freq_12K\\anal_data\\Neg_rest\\'); % 此处载入一个缺失marker的数据
eeglab redraw
% 设置marker参数
type = 66; % marker的类型,这里需要为数字
start = 1000; % marker的起点
duration = 2000; % marker的间距,如果需要实现复杂的间隔,按需要修改
% marker的处理
latency = start:duration:EEG.times(end); % time, in ms
type = type * ones(1,length(latency));
event_values = [type' latency'];
% 添加marker的语句
[EEG, eventnumbers] = pop_importevent(EEG, 'event', ...
event_values, 'fields', {'type', 'latency'}, ...
'append', 'no', 'align', NaN, 'timeunit', 1E-3 );
EEG = pop_saveset( EEG, 'filename','addmarker_F_0170_01.set','filepath','D:\Down\TEM'); % 保存添加marker后的数据;
eeglab redraw```