Emotiv / labstreaminglayer

Lab Stream Layer support with EMOTIV Brainwear
MIT License
48 stars 9 forks source link

Matlab crashes #2

Closed SonyaLiao closed 3 years ago

SonyaLiao commented 3 years ago

I was trying to connect Matlab and EmotivPro with LSL. I tried to follow the instruction you shared and using the 'sendmarker.m' file. It showed on EmotivPro that MatlabMarker is 'connected,' but Matlab crashed in several seconds after running the script.

The error messages showed in Matlab: Now send marker data... Send marker has value: 82

Unrecognized function or variable 'lsl_push_sample'.

Error in lsl_outlet/push_sample (line 66) lsl_push_sample(self.LibHandle,self.OutletHandle,sampledata,timestamp,pushthrough);

Error in sendmarker (line 58) outlet.push_sample(data);

I'm using Matlab 2019b with Mac OS 10.15.7 Could you kindly advise the potential reason for this, and how can I solve the problem? Thank you! sendmarker.m.zip

tungntEmotiv commented 3 years ago

Hi @SonyaLiao ,

We not sure about the root cause of this issue. But the issue might be from mex library which built ourselves on matlab 2017b. Please follow below guide for fixing:

  1. Download lsl matlab library from https://github.com/labstreaminglayer/liblsl-Matlab/releases/ liblsl1_13_0_b13-MatlabR2019a-MacOS10_14.zip . Extract the zip file
  2. Replace ./matlab/liblsl-Matlab in emotiv matlab examples folder with the same folder in the extracted folder.
  3. Replace all files in ./matlab/bin/mac in emotiv matlab examples folder with liblsl-Matlab/bin folder in extracted folder.

I mean that we will replace the current matlab lib by latest one. Please try and let us know result. We will update to latest version of lsl matlab library soon. Thanks for your question.

tungntEmotiv commented 3 years ago

Hi @SonyaLiao ,

We not sure about the root cause of this issue. But the issue might be from mex library which built ourselves on matlab 2017b. Please follow below guide for fixing:

  1. Download lsl matlab library from https://github.com/labstreaminglayer/liblsl-Matlab/releases/ liblsl1_13_0_b13-MatlabR2019a-MacOS10_14.zip . Extract the zip file
  2. Replace ./matlab/liblsl-Matlab in emotiv matlab examples folder with the same folder in the extracted folder.
  3. Replace all files in ./matlab/bin/mac in emotiv matlab examples folder with liblsl-Matlab/bin folder in extracted folder.

I mean that we will replace the current matlab lib by latest one. Please try and let us know result. We will update to latest version of lsl matlab library soon. Thanks for your question.

SonyaLiao commented 3 years ago

Hi @SonyaLiao ,

We not sure about the root cause of this issue. But the issue might be from mex library which built ourselves on matlab 2017b. Please follow below guide for fixing:

  1. Download lsl matlab library from https://github.com/labstreaminglayer/liblsl-Matlab/releases/ liblsl1_13_0_b13-MatlabR2019a-MacOS10_14.zip . Extract the zip file
  2. Replace ./matlab/liblsl-Matlab in emotiv matlab examples folder with the same folder in the extracted folder.
  3. Replace all files in ./matlab/bin/mac in emotiv matlab examples folder with liblsl-Matlab/bin folder in extracted folder.

I mean that we will replace the current matlab lib by latest one. Please try and let us know result. We will update to latest version of lsl matlab library soon. Thanks for your question.

Thank you! It is working perfectly now!

SonyaLiao commented 3 years ago

Hi @SonyaLiao ,

We not sure about the root cause of this issue. But the issue might be from mex library which built ourselves on matlab 2017b. Please follow below guide for fixing:

  1. Download lsl matlab library from https://github.com/labstreaminglayer/liblsl-Matlab/releases/ liblsl1_13_0_b13-MatlabR2019a-MacOS10_14.zip . Extract the zip file
  2. Replace ./matlab/liblsl-Matlab in emotiv matlab examples folder with the same folder in the extracted folder.
  3. Replace all files in ./matlab/bin/mac in emotiv matlab examples folder with liblsl-Matlab/bin folder in extracted folder.

I mean that we will replace the current matlab lib by latest one. Please try and let us know result. We will update to latest version of lsl matlab library soon. Thanks for your question.

Hi tungntEmotiv,

I have a further question in terms of how the marker represents in the CSV file. After running the sendmarker.m, I was able to see the red lines become visible in the data stream, but in the CSV file, I couldn't find any hint of the markers. I tried to run SendDataInChunks.m and I can see there was numeric value under MakerIndex, MarkerType, and MakerValueInt in the csv file. Am I able to view the marker in the csv file after running sendmarker.m?

Thank you in advance. Sonya

tungntEmotiv commented 3 years ago

Hi @SonyaLiao ,

That's weird. I still see the marker in the csv files after exporting via EmotivPro. ( I am using EmotivPro 2.6.1). You can see the attached file ( tungtestmarker_19.11.20_13.27.57.md.csv.zip ) You can see the marker value each second in the file. In theory, you can see the marker data in csv file. Do you meet any error when you send marker ?

SonyaLiao commented 3 years ago

Hi @SonyaLiao ,

That's weird. I still see the marker in the csv files after exporting via EmotivPro. ( I am using EmotivPro 2.6.1). You can see the attached file ( tungtestmarker_19.11.20_13.27.57.md.csv.zip ) You can see the marker value each second in the file. In theory, you can see the marker data in csv file. Do you meet any error when you send marker ?

Hi tungntEmotiv,

Thank you for your kind reply and for sending your document. I realized it was my fault. The markers were there in my document. I just did not notice them. I will just close this issue. Thank you again. Sonya