Page 1 of 1

Troubles with Online Signal Processing

Posted: 26 Dec 2011, 11:48
by lukmitchell
Hello all,

We are having issues in the lab I work in with properly setting up the MATLAB filter code for online signal processing. A lot of the problem seems to be coming from duplicate or missing MATLAB files. We used the general form of MATLAB codes for bci_Prerun, bci_Initialize, bci_Process, etc. found on BCI2000 Wiki and then tailored this code to give us the exact processing of the data we require for our purposes of running the Cursor Task module using the Signal Processing module. However, we are receiving several errors. For instance, bci_Initialize would not run until we moved the "compiler" folder out of the MATLAB toolbox because of some apparent conflict. Once that was done, bci_Process produced errors while running, such as: 'Undefined function of variable "eml_transient,"' and 'Undefined function or variable "eml_allow_enum_inputs."' It seems that the MATLAB engine launched with the Signal Processing module is trying to access these "eml" functions instead of the built in MATLAB functions and this is giving us errors because we don't seem to have the "eml" functions on our computer. Could this be an issue with a path setting, or are these "eml" files something we are supposed to have somewhere? I appreciate any help or ideas that anyone can offer!

On a side note, we did a run where we changed bci_Process to essentially do nothing so as not to raise the undefined variable errors, and we got the Cursor Task module started. We didn't have any electrodes hooked up to our amp, and the ball was steadily drifting right. However, after a short time, an error occurred stating "round trip time exceeds block duration." This gave us concern seeing as it happened when we essentially had no signal processing actually taking place. Does this seem like it will be an issue?

Thanks in advance!


Re: Troubles with Online Signal Processing

Posted: 28 Dec 2011, 15:48
by jawilson
A couple of things. Starting at the end, the "Round trip time..." error means that BCI2000 is unable to process data quickly enough. That is, the Sample Block Duration (e.g., 50 ms) is shorter than the processing time (e.g., 75 ms), so you will not have real-time capability. However, this may be due to the errors you are encountering, so you can ignore this for now; I think there may be a parameter that can turn this check off as well.

2nd, are you able to run the stock matlab signal processing code that comes with BCI2000? Does this give you errors?

Would you be willing to send me the matlab files you are trying to use?


Re: Troubles with Online Signal Processing

Posted: 30 Dec 2011, 13:11
by lukmitchell

I believe we were getting errors even from the stock MATLAB signal processing code in BCI2000, but I will have to double check that to make sure. Unfortunately, I am away from the lab on holiday for a few more days.

I will pm you our code, though. Thanks!


Re: Troubles with Online Signal Processing

Posted: 04 Jan 2012, 17:18
by lukmitchell
We have been delving into this problem more since I got back and I have an update on what's happening:

As I mentioned, we have bci_preflight, bci_initialize, bci_process, and bci_construct files taken straight from the BCI2000 wiki page on MATLAB based filters. The process and construct files were slightly modified for our purposes. Our problem seems to be arising from the MATLAB engine that launches when we start the cursor task module. When we start the engine, we get a large number of function conflicts, all with the destination: C:\Program Files\MATLAB\R2011a\toolbox\xxx\xxx\ja\, where xxx represents various MATLAB and Simulink toolbox folders. We are speculating that these function conflicts may be what is causing us to receive the "round trip exceeds block duration" error from the cursor task module even when we cut down our bci_process file to basically do nothing.
Lastly, we have noticed that for some reason, opening the MATLAB engine changes the pathdef.m file to something undesirable, and it affects both the engine and the standalone MATLAB program. After this happens, we open the standalone MATLAB program and receive a long list of conflicts with built-in MATLAB functions.

Could anyone tell me what these "ja" files are or why the MATLAB engine seems to be upsetting the pathdef? Thanks again!