Real time EEG with Olimex

1 view (last 30 days)
Lisa Suette
Lisa Suette on 23 Jun 2021
Hello,
I need to write a code to plot a real time EEG of 2 Channels with the Olimex Amplifier. My problem is that I don't get any values from my amplifier. My code looks like this so far:
clc;
clear;
if ~isempty(instrfind)
fclose(instrfind);
delete(instrfind);
end
EEG = serial("COM3","BaudRate",57600, "Timeout",30);
%readline(EEG)
EEG.Terminator = "CR/LF";
EEG.InputBufferSize = 65000;
fopen(EEG);
%a = fscanf(EEG);
i = 1;
while(1)
data(i) = str2double(fscanf(EEG));
plot(data)
drawnow()
i = i+1;
pause(0.001)
%daten = readline(EEG)
end
but everytime I get this warning:
Warning: Unsuccessful read: The input buffer was filled before the Terminator was reached.
'serial' unable to read all requested data. For more information on possible reasons, see Serial Read Warnings.
and instead of some data I just get an array full of "NaN"s so I think that the mistake has to be in the line with str2double(fscanf(EEG)) because for my EEG data I always get something like this:

Answers (0)

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!