Page 1 of 1

EEGLAB .dat file import error

Posted: 06 Mar 2014, 10:16
by shaman
I am trying to import bci2000 .dat files into matlab using eeglab v11.0.4.3b. On importing data using "Import BCI .dat files" i get a _loadBCI2000.m error that reads "Expression or statement is incorrect-possibly unbalanced (,{ or [."
Has anyone faced this problem and what have you done about it?

Re: EEGLAB .dat file import error

Posted: 06 Mar 2014, 12:34
by boulay
If you can use a new version of EEGLAB (v13.x) then please do that. The new version of EEGLAB has a menu to download plugins, including a newer version of the BCI2000 data import plugin that I modified last year.

Let me know if you are on a Mac. The Mac binaries are 2 years older than the windows binaries, and this creates a problem in my code. I'd like to create new binaries, but this is a slow process. If you need the plugin fixed for Macs now then I will do that quick patch first.

Re: EEGLAB .dat file import error

Posted: 07 Mar 2014, 08:56
by shaman
No i am on windows 8.
i used the latest version of eeglab(v 13.x) and further downloaded the latest version of BCI2000-IMPORT plugin(v 0.34).
But the same problem persists on attempting to import the .dat file option.

Re: EEGLAB .dat file import error

Posted: 07 Mar 2014, 11:28
by boulay
I've attached a (slightly) updated version of pop_loadBCI2000.m . However, this does not differ from the version downloaded with the plugin in a way that would fix the error you see. I can only guess that either you are not using the correct version of the plugin (perhaps the old eeglab is still on the path? Please check that) or there is something specific to your system, though I can't imagine what.

[Edit: I deleted the file. Please see the post below.]

Re: EEGLAB .dat file import error

Posted: 09 Mar 2014, 09:06
by shaman
no i checked the path and i am using the latest version of the plugins.
On running the pop_loadBCI2000.m file it says error on line 99 with an unbalanced bracket.

Re: EEGLAB .dat file import error

Posted: 09 Mar 2014, 20:16
by boulay
Ah I think I know what it is. Are you using a version of Matlab older than 2009b? I'll patch the function, upload it here, and also post it to the EEGLAB repository. I'll do that sometime within the next 24 hours. Sorry about that.

Re: EEGLAB .dat file import error

Posted: 09 Mar 2014, 21:36
by boulay
See the attached file. I will add it to the BCI2000 svn and the EEGLAB repo soon.

Re: EEGLAB .dat file import error

Posted: 11 Mar 2014, 10:11
by shaman
YES it worked.thank you so much.

Re: EEGLAB .dat file import error

Posted: 11 Mar 2014, 10:18
by shaman
There is another issue that i am facing during import of the .dat BCI file.
On selecting the necessary .dat file there is a "SELECT EVENT" option from which i need to select "RUNNING".
On doing so a warning appears on MATLAB command window saying:"'Running' is not a valid event for EEGLAB. This event is being
discarded."
And subsequently i am not able to export the file using DATA and ICA activity to text file option.
The error says "invalid file identifier.Use fopen to generate a valid file identifier"

Re: EEGLAB .dat file import error

Posted: 11 Mar 2014, 11:25
by boulay
For EEGLAB to be useful, you need to have "Events" in your data. These events may be subsequently used to break up your data into epochs, time-locked to an event.

The "SELECT EVENT" dialog box allows you to choose the BCI2000 state variables to convert to events. Only BCI2000 states that change, but not-too-frequently, are useful as events. "RUNNING" is not useful because it never changes. Similarly, anything like a clock would not be useful because it always changes. Some States that are useful are things like "StimulusCode". You should pick all the states (you can pick more than 1) that you need to convert into events to time-lock your data (something similar to a "StimulusOn" event) and to know what kind of trial it is (e.g. "StimulusCode").

Please let me know if you do not have states that meet these criteria. I guess I never thought that someone would want to use EEGLAB to analyze data that didn't already have states->events. If that is the case, then I need to change the code a bit to allow for that.