How do I use the buffer function to operate real time on EEG signal files?
Hello, I’ve got a code where I detect signals through thresholding, but I’d like for the thresholding to reapply to the signal every 40 seconds or so if I enter a 5 minute signal. I’ve found buffering can help with this, but I am having some issues applying it. I want to segment the signal into 40 second segments (can be overlapping or non overlapping), however since the original signal (300 seconds) has been multiplied by the frequency 256, it is now 76800 values and I’m slightly confused. I am not sure which variables to alter, and the wiki example doesn’t seem to apply to my signal type. I help appreciate some help understanding how the function works and how to apply if possible.
eegsignal = (data_array2(710656:787456)); %signal to be inserted around 5 mins long
%contains non-seizure and then seizure
fs = 256;
frame_length = 40
signal_length = 300*256
sig = buffer(1:76800,40);
n = 5;
p = 1;
opt = -5;
z = [];
for i = 1:size(sig,2)
x = sig(:,i);
[y,z,oppt] = buffer([z;x],n,p,opt);
if i <= 4
disp(‘no seizure’)
end
opt = oppt;
endHello, I’ve got a code where I detect signals through thresholding, but I’d like for the thresholding to reapply to the signal every 40 seconds or so if I enter a 5 minute signal. I’ve found buffering can help with this, but I am having some issues applying it. I want to segment the signal into 40 second segments (can be overlapping or non overlapping), however since the original signal (300 seconds) has been multiplied by the frequency 256, it is now 76800 values and I’m slightly confused. I am not sure which variables to alter, and the wiki example doesn’t seem to apply to my signal type. I help appreciate some help understanding how the function works and how to apply if possible.
eegsignal = (data_array2(710656:787456)); %signal to be inserted around 5 mins long
%contains non-seizure and then seizure
fs = 256;
frame_length = 40
signal_length = 300*256
sig = buffer(1:76800,40);
n = 5;
p = 1;
opt = -5;
z = [];
for i = 1:size(sig,2)
x = sig(:,i);
[y,z,oppt] = buffer([z;x],n,p,opt);
if i <= 4
disp(‘no seizure’)
end
opt = oppt;
end Hello, I’ve got a code where I detect signals through thresholding, but I’d like for the thresholding to reapply to the signal every 40 seconds or so if I enter a 5 minute signal. I’ve found buffering can help with this, but I am having some issues applying it. I want to segment the signal into 40 second segments (can be overlapping or non overlapping), however since the original signal (300 seconds) has been multiplied by the frequency 256, it is now 76800 values and I’m slightly confused. I am not sure which variables to alter, and the wiki example doesn’t seem to apply to my signal type. I help appreciate some help understanding how the function works and how to apply if possible.
eegsignal = (data_array2(710656:787456)); %signal to be inserted around 5 mins long
%contains non-seizure and then seizure
fs = 256;
frame_length = 40
signal_length = 300*256
sig = buffer(1:76800,40);
n = 5;
p = 1;
opt = -5;
z = [];
for i = 1:size(sig,2)
x = sig(:,i);
[y,z,oppt] = buffer([z;x],n,p,opt);
if i <= 4
disp(‘no seizure’)
end
opt = oppt;
end buffer, real time, function, eeg, image segmentation MATLAB Answers — New Questions