Missing Data from bci2000 to BCILAB using MatlabSignalProcessing
Posted: 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 from this line of code:
The signal variable contained only the string 'bci2000_stream' rather than the actual stream of data, so I added in the line:
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:
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
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'."Code: Select all
query = fieldnames(signal)';Code: Select all
signal = evalin('base',signal);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);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