将biopac的生理电数据读入EEGLAB后,如何得到event信息?

使用biopac软件记录了心电,肌电和皮电数据后,将数据导入到eeglab中,发现,缺少event信息,也就是,EEG.event是空的,同时,在EEG.data里发现,除了记录的数据,mark信息是在多个channel中保存的,比如:第16导记录的是1,第15导记录的是2,第14导记录的是4,以此类推。如果mark是5,那么会在第16导和第14导都有记录,通过两个导的相加得到实际的mark。

以下函数可以自动将10-16导记录的mark信息转换成EEG.event, 这样就可以像脑电数据那样在EEGLAB中进行分析了


function eventMaker(savename,savepath)
%this function is for making EEG.event after importing the biopac data into
%EEGLAB with the biopac extention
%input:  a string to indicate the name of the saved file after running 
%this function ; a string to inciate the location to place the data

%output: an EEG .set data and .fdt data

%the function assumes that channel 10 to channel 16 are the channels to
%record event triggers; channel 10 represents 2^7, channel 11 represents
%2^6, channel 12 represents 2^5, and so forth. Event markers are the sum
%of all seven channels in a specific time points

%the result is an EEG structure with the updated EEG.event, EEG.urevent and
%EEG.enentdescription

markers=[];
EEG.data(10:16,:)=EEG.data(10:16,:)/5;
base=[];
for j=10:16
    base(j-9)=2^(16-j);
end

mchannel=[];
for i=1:size(EEG.times,2)
    mchannel(1:7,i)=base.*vec2mat(EEG.data(10:16,i),7);
end

for i=1:size(EEG.times,2)
    markers(i)=sum(mchannel(1:7,i));
end

event=[];
events=[];
timepoint=[];
sequence=0;
EEG.event.type=0;
EEG.event.latency=0;
EEG.event.urevent=0;
for i=2:size(EEG.times,2)
    if markers(i)>0 & markers(i)~=markers(i-1)
        event=markers(i);
        timepoint=EEG.times(i);
        sequence=sequence+1;
        EEG.event(sequence).type=event;
        EEG.event(sequence).latency=timepoint;
        EEG.event(sequence).urevent=sequence;
        %events=[event,timepoint,sequence];
        %EEG.event=[EEG.event;events];
    end
end
EEG.urevent=EEG.event;
EEG.eventdescription={0,0,0};
pop_saveset( EEG, 'filename',savename,'filepath',savepath);



 

  • 1
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值