Page 1 of 1

Problem with streamed matrix output in Matlab scripting

Posted: Thu Apr 21, 2016 8:38 am
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.

Re: Problem with streamed matrix output in Matlab scripting

Posted: Mon Apr 25, 2016 12:20 pm
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

Re: Problem with streamed matrix output in Matlab scripting

Posted: Mon Apr 25, 2016 2:29 pm
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