Missing Data from bci2000 to BCILAB using MatlabSignalProcessing

Forum for software developers to discuss BCI2000 software development
Post Reply
mrphunter
Posts: 4
Joined: 02 Jun 2015, 15:04

Missing Data from bci2000 to BCILAB using MatlabSignalProcessing

Post by mrphunter » 16 Sep 2015, 13:09

I'm using the MatlabSignalProcessing module to process singals coming from the Emotiv cap. So far I have trained a predictive model offline and am now using functions from Matlab and BCILAB to make predictions online. However, the prediction (using onl_predict) always comes out as NaN, based on errors relating to missing pieces of information from BCI2000 to Matlab.

There were a couple of errors relating to referencing fields of non-structure arrays which I have managed to fix.

Then I was receiving the error

Code: Select all

"undefined function 'fieldnames' for input arguments of type 'char'."
from this line of code:

Code: Select all

query = fieldnames(signal)';
The signal variable contained only the string 'bci2000_stream' rather than the actual stream of data, so I added in the line:

Code: Select all

signal = evalin('base',signal);
This succesfully replaced the string name with an actual matlab structure containing information about the stream at this point. However, then I get the error "Reference to non existent field 'data'." from this piece of code in the onl_filtered function:

Code: Select all

        % call stateful filter function (appending previous state, retrieving new state)
        [chunk,p.state] = p.head(inputs{:}, 'state',p.state);
        save('Chunk-onl_filtered160','chunk');
        % increment .smax with what we got (p.head might change the sampling rate)
        chunk.smax = p.buffer.smax + size(chunk.data,2);
The chunk structure is exactly the same (apart from timestamps) as the signal structure encoded by 'bci2000_stream'. It seems to have some of the information about the stream e.g. signaling rate, number of channels, but contains no actual data. Here is the structure of bci2000_stream:

setname: 'new set'
filename: ''
filepath: ''
subject: ''
group: ''
condition: ''
session: []
comments: ''
nbchan: 14
trials: 1
srate: 128
xmin: 0
times: []
icaact: []
icawinv: []
icasphere: []
icaweights: []
icachansind: []
chanlocs: [1x14 struct]
urchanlocs: []
chaninfo: [1x1 struct]
ref: 1
event: []
urevent: []
eventdescription: {}
epoch: []
epochdescription: {}
reject: [1x1 struct]
stats: [1x1 struct]
specdata: []
specicaact: []
splinefile: ''
icasplinefile: ''
dipfit: []
history: ''
saved: 'no'
etc: []
buffer_len: 1280
timestamps_len: 25
types: {'EEG'}
arg_direct: 0
tracking: [1x1 struct]
buffer: [14x1280 double]
smax: 0
timestamps: [25x2 double]
timestamps_ptr: 0
streamid: 1
xmin_micro: 17005244449
xmin_mili: 1.4423e+12
xmin_nano: 6.1613e+12


I am concerned firstly that I am editing BCILAB code which shouldn't need to be edited. The functions bci_Process etc... have also all been tried and tested in a previous project with no problems. In the bci_process function I append the new block of data coming in onto bci2000_stream and then call onl_predict as does the example online.

I'm using the latest releawse of BCILAB 1.1, but got similar results from using 1.0, and I'm not sure if this is important but I am using a 64 bit version of the MatlabSignalProcessing module downloaded from this page:
http://www.bci2000.org/phpbb/viewtopic. ... 9&start=15

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: Missing Data from bci2000 to BCILAB using MatlabSignalProcessing

Post by pbrunner » 16 Sep 2015, 15:11

Mrphunter,

looking through your bug report, it seems that this is related to the functions implemented with the EEGLAB online plugin for BCI2000.

I have contacted the original author of this online plugin and cc'ed you on that email. I hope that he, or somebody from the EEGLAB team will be able to resolve the issue.

In the meantime, can you please verify that the reported issue persists in the v3.6 beta. You find the link to the binaries in the email that you have just received. Please report back with your findings.

Regards, Peter

mrphunter
Posts: 4
Joined: 02 Jun 2015, 15:04

Re: Missing Data from bci2000 to BCILAB using MatlabSignalProcessing

Post by mrphunter » 17 Sep 2015, 11:55

Thanks for the reply and for cc'ing me. So far with v3.6b, once I hit Set Config I get the error:

Code: Select all

2015-09-17T16:51:02 - Operator set configuration.
2015-09-17T16:51:03 - SignalSource: Emotiv initialized.
2015-09-17T16:51:03 - Application error, StimulusPresentationTask::Preflight:
Stimuli.
2015-09-17T16:51:03 - SignalProcessing: Initialized.
I'm not sure what the problem is with the stimuli so I haven't been able to test the BCILAB functions yet.

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: Missing Data from bci2000 to BCILAB using MatlabSignalProcessing

Post by pbrunner » 17 Sep 2015, 12:07

Mrphunter,

can you please try to start the stock "StimulusPresentation_SignalGenerator.bat" that came with the beta and report back whether you experience the same issue?

Regards, Peter

mrphunter
Posts: 4
Joined: 02 Jun 2015, 15:04

Re: Missing Data from bci2000 to BCILAB using MatlabSignalProcessing

Post by mrphunter » 18 Sep 2015, 11:41

It's working now I'm using the application parameters from the example. But unfortunately I get the same errors from processing as before. Is there something I could have missed in the offline training or a parameter I might not have set that could be leading to this?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests