Matlab scripting box crashes

Concerning processing components: filters, file load/save, visualizations, communication ...
Post Reply
Legilmoon
Posts: 2
Joined: Wed Nov 28, 2012 10:01 am

Matlab scripting box crashes

Post by Legilmoon »

Hi,
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
Thanks for your help!

Legilmoon
Posts: 2
Joined: Wed Nov 28, 2012 10:01 am

Re: Matlab scripting box crashes

Post by Legilmoon »

Problem solved:

It was a bad header initialisation as said in the tutorial:
If you construct a somehow corrupted header or a header that does not match the theoretical stream structure, the application has a good chance of crash.
For example, if you omit a field or use a field incorrectly (e.g. header.sampling_rate = 'plop') the Designer can just randomly crash during execution. We are aware of this problem and we will try to improve error handling in the following updates.
i was more or less writing 'plop' :roll:

Post Reply