I'm new to Openvibe. I am currently trying to use it for a motor imagery task, but for some reasons, I would like to use matlab for the processing
(mainly feature selection and classification), so I tried to use the matlab scripting box.
The problem is that Openvibe crashes just after it has ended the first call to the process function of the matlab box. I'm not really sure of what I'm doing wrong.
Basically I want to process each chunk with a function f which returns as a response a matrix. I would like to have this matrix go back in openvibe as a streamed matrix.
My scenario is simply a GDF file reader followed by a temporal filter and then the matlab scripting box with an input signal and a streamed matrix as output.
Here is a matlab code that operates the same as the one I have (just easier to read):
Code: Select all
function box_out = test (box_in)
for i = 1: OV_getNbPendingInputChunk (box_in,1)
[ box_in, start_time, end_time, data_chunk ]= OV_popInputBuffer(box_in,1);
[ data_chunk_transform ] = f ( data_chunk, 1:30, 128 );
% data_chunk_transform is a 30x16 matrix
[ box_in ] = OV_setStreamedMatrixOutputHeader(box_in, 1, 2, size(data_chunk_transform ), {'freq','chan'})
[ box_in ] = OV_addOutputBuffer(box_in, 1, start_time, end_time, data_chunk_transform);
end
box_out = box_in;
% just to check
imagesc(box_out.outputs{1}.buffer{1}.matrix_data);
disp(box_out.outputs{1}.header);
end