Unable to input OpenBCI LSL stream in BCILAB

avujicavujic United States
edited August 2016 in Software
Hi all, 
I would like to use MatLab + BCILAB to pre-process, classify, and visualize real-time EEG data from OpenBCI.

Using an OpenBCI board streaming into LSL I'd like to stream into MatLab with BCILAB's LSL receive. In the BCILAB doc it says that if you do this and then select the following option:

image

You should be able to stream live data into BCILAB. However, BCILAB gets stuck on:

Looking for a device with type='EEG' ...

And then gives the following message when I interrupt:

Operation terminated by user during lsl_resolve_bypred (line 35)

In run_readlsl (line 108)

        result = lsl_resolve_bypred(lib,opts.data_query); end


Strangely enough, when I run LSL's ReceiveData.py I'm able to receive the stream just fine. However, when I run ReceiveData.m it again gets stuck at:

>> ReceiveData
Loading the library...
Resolving an EEG stream...

And then when I interrupt:
Operation terminated by user during lsl_resolve_byprop (line 37)
In ReceiveData (line 9)
    result = lsl_resolve_byprop(lib,'type','EEG'); end


It seems MatLab's LSL isn't able to resolve the EEG stream from OpenBCI even though Python LSL can. What do I need to do to?

Details:
Python 2.7 virtual environment
BCILAB 1.2 alpha
Matlab 2013b ( 8.2) with this patch (BCILAB is buggy with more recent MatLab versions) 


 

 

Comments

  • GabeIbagonGabeIbagon San Diego, California
    edited August 2016
    Since Matlab is not returning any errors during LSL startup, I doubt that it is a dependency issue. Still, you might want to double check that you have the correct dependencies anyway. For BCILAB, there should be a folder in your BCILAB directory with the liblsl-Matlab scripts and binaries (mine is located at "BCILAB-1.1/dependencies/liblsl-Matlab". There should be a few Matlab scripts, as well as a "bin" folder with the appropriate binary files for your operating system. 

    The folder should look like this: 

    Also make sure that this folder is included in your Matlab path.

    If it's not a dependency issue, you should try changing the parameters that Matlab uses to find the LSL stream. The default in BCILAB and ReceiveData.m is 'type''EEG'. You might want to try searching by name or source_id. In the ReceiveData.m script, you should change the line:

    result = lsl_resolve_byprop(lib,'type','EEG'); end
    to
    result = lsl_resolve_byprop(lib,'name','OpenBCI_EEG'); end
    or
    result = lsl_resolve_byprop(lib,'source_id','openbci_eeg_id1'); end

    Make sure that those parameters you're using in Matlab to identify the stream match the ones used in the Python code (created using "StreamInfo()" in Python).

    Good luck!
  • avujic,

    Have you resolved this problem? I also got stuck as you at 

    >> ReceiveData
    Loading the library...
    Resolving an EEG stream...

    GabeIbagon suggested, but neither of them worked.
    When I ran ReceiveData.m, matlab just didn't give any response, even a warning or error. And the I had to force to quit it to exit the program. That's really weird!
  • mohitvirmani11mohitvirmani11 New Delhi
    edited January 2018
    I am trying to use OpenBCI with LSL and BCILAB. I chose 'Online Analysis-> Read Input from ... -> Lab streaming layer...' in BCILAB and it loads the window to input parameters for run_readlsl() without any errors. 

    Then I choose type='EEG', name='openbci_eeg', source_id='openbci_eeg_id38' one after the other in "Data Stream query" in run_readlsl(), but in all cases I get the following error. 



    Operation terminated by user during lsl_resolve_bypred (line 35)


    In run_readlsl (line 111)
            result = lsl_resolve_bypred(lib,opts.data_query); end

    In arg_guidialog (line 238)
            [varargout{1:nargout(func)}] = func(oldparams{:},params);
     
    Interrupt while evaluating Menu Callback.


    Has anyone been able to solve this yet? 

    Thanks in advance for the help. 

  • LSL support in the GUI is horrible... people on all operating systems seem to have problems.
  • mizanur36mizanur36 Dallas, TX
    Did anyone get it working. I am getting same error.

    >> ReceiveData
    Loading the library...
    Resolving an EEG stream...

    When I kill the program, I get below error

    In ReceiveData (line 11)
        result = lsl_resolve_byprop(lib,'type','EEG'); end
  • wjcroftwjcroft Mount Shasta, CA
    @mizanur36, did you see the earlier post in this thread??


    Is it possible that the stream type is not 'EEG', but instead something else?

  • mizanur36mizanur36 Dallas, TX
    I have double checked, stream type is EEG. I can consume LSL stream using 'type','EEG' using pylsl. It is matlab that not finding the stream. In matlab type is also EEG. below is the matlab code. Code is stuck in while loop where it is expecting lsl stream of type 'EEG' and not finding data







    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #25992d}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #b245f3}
    p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier}
    p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; min-height: 12.0px}
    p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #0433ff}
    span.s1 {color: #000000}
    span.s2 {color: #0433ff}
    span.s3 {color: #b245f3}

    %% 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

  • mizanur36mizanur36 Dallas, TX
    BTW, I am using MAC not Windows. I already have tried the vs_stream earlier and got below error

    >> vis_stream
    /Users/v614781/tools/tester2/bci/labs/BCILAB/dependencies/liblsl-Matlab/bin/liblsl64.dylib
    Error using vis_stream>find_streams (line 224)
    There is no stream visible on the network.

    Error in vis_stream (line 77)
    streamnames = find_streams(lib);
  • mizanur36mizanur36 Dallas, TX
    it is same issue that "Avujic" opened in 2016. But I don't see any resolution to this issue in this discussion which that person started in 2016. Lot of others experienced the same subsequently which I see in this discussion. But don't see any solution :(
  • wjcroftwjcroft Mount Shasta, CA
    Solution from @mizanur36, posted on other thread,

    It appears the issue was the liblsl64.dylib version. I have downloaded a newer version from https://github.com/Epist/bci_focus/blob/master/Server/bin/liblsl64.dylib link and now I can see LSL stream in MATLAB
Sign In or Register to comment.