labstreaminglayer / liblsl-Matlab

Matlab bindings for liblsl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Matlab crashing after receiving data from OpenBCI

alessiaca opened this issue · comments

I am trying to save data from OpenBCI in Matlab during an experiment in PsychToolbox. I am working with Ubuntu 20.04.1 LTS in a dual boot system, but I am really new to it.

When I run the following script the data from OpenBCI is printed for ca. 5 sec and then Matlab crashes/closes with the following error:

%% instantiate the library
disp('Loading the library...');
lib = lsl_loadlib();
% resolve a stream...
disp('Resolving an EEG stream...');
result = {};
while isempty(result)
    result = lsl_resolve_byprop(lib,'type','EEG'); end
% create a new inlet
disp('Opening an inlet...');
inlet = lsl_inlet(result{1});
disp('Now receiving data...');
while true
    % get data from the inlet
    [vec,ts] = inlet.pull_sample();
    % and display it
    fprintf('%.2f\t',vec);
    fprintf('%.5f\n',ts);
end

Loguru caught a signal: SIGSEGV
2020-12-08 13:27:04.451 ( 0.679s) [ 65B22700] :0
FATL| Signal: SIGSEGV

Can someone help me to fix this problem? I have already looked all over the internet.