Problem with streamed matrix output in Matlab scripting

About BCI and box tutorial/demo scenarios bundled with OpenViBE.
Post Reply
mmk11
Posts: 2
Joined: Wed Apr 20, 2016 1:57 pm

Problem with streamed matrix output in Matlab scripting

Post by mmk11 »

Hi,
I am trying to use my matlab code to classify EEG signals in Openvibe. My matlab script box has one signal input and one matrix output.Unfortunately, I wasn't able to find any resources/examples for streamed matrix output. So I summarize my questions as follows:

- Should I define headers for input/output in initialize.m or in process.m or both?

- How can I define header for streamed matrix output? Currently I am using the below line that causes the program to crash:
box_in = OV_setStreamedMatrixOutputHeader(box_in, 1, 2, [1 2], ['R', 'L']); (for output matrices like [0.6 0.4])

- How can I put matrices in the output? Is it right to use:
box_in = OV_addOutputBuffer(box_in,2,start_time,end_time,matrix);


Any help is appreciated.

jtlindgren
Posts: 778
Joined: Tue Dec 04, 2012 3:53 pm
Location: INRIA Rennes, FRANCE

Re: Problem with streamed matrix output in Matlab scripting

Post by jtlindgren »

Hi mmk11,

it seems there's a bug regarding the matrix outputs. You can try fix it by replacing the file OV_getStreamedMatrixOutputHeader.m in your openvibe installation with the corresponding file in the attached zip. Then you can try the scenario in the zip. It should produce 4 channels of uniform random data. I hacked it from the sinus tutorial. The main difference is that for matrix outputs, it seems you need to specify both row and column channel names. For signals, it seems channel names is sufficient.

Please let me know if this works for you!


Cheers,
Jussi
Attachments
ov-matlab-matrix-output.zip
(4.25 KiB) Downloaded 284 times

mmk11
Posts: 2
Joined: Wed Apr 20, 2016 1:57 pm

Re: Problem with streamed matrix output in Matlab scripting

Post by mmk11 »

Hi Jussi,

I used the OV_getStreamedMatrixOutputHeader.m file you sent and the example is working fine. I was also able to use it successfully in my own code.
Thank you for your help!
Cheers

Post Reply