Page 1 of 1

State saving in text file

Posted: 25 Jan 2012, 08:23
by vladi
Hallo,

I would like to save some state vektors like Feedback and Running in a text file after the end of a run. I would really appreciate if somebody could give a hint hove I could manage this. TIA

Re: State saving in text file

Posted: 25 Jan 2012, 09:15
by mellinger
Hi,

there are several ways to do this. My preferred way is the following:
* Make sure the directory <your BCI2000 path>/tools/cmdline is in your system's PATH variable.
* On your desktop, create a file named ExtractStates.cmd, with the following text content:

Code: Select all

bci_dat2stream --transmit-s < "%1" | bci_stream2table > "%1.states.txt" 
* Drag-and-drop a recorded BCI2000 *.dat file onto the script to obtain a text file that contains the states from the file, in form of a table with state names provided in the file's first line.

Alternatively, you may use the AppConnector protocol to read states from BCI2000 while it is running, so you may write them into a file (see http://www.bci2000.org/wiki/index.php/T ... _Connector for reference). Using output redirection to a file, you can use the unmodified SimpleExample program provided at BCI2000/src/contrib/AppConnectorApplications/SimpleExample, or add a state name comparison to suppress unwanted states from the output.

Regards,
Juergen

Re: State saving in text file

Posted: 26 Jan 2012, 06:13
by vladi
Hallo,

thank you for your help. I tried the option with the batch file and it didn't worked. After some testing I could extract one parameter this way:

bci_dat2stream --transmit-s < S001R01.dat | bci_stream2asc | grep Feedback > feedback.txt

Now I would like to extract for example feedback and running with the same batch in the same text file. I couldn't find a way to do this.

Greetings,
Vladi

Re: State saving in text file

Posted: 30 Jan 2012, 08:30
by mellinger
Hi,

in the meantime, I fixed bci_stream2table, so the suggested batch file should work.

When you have grep available, you may just tell it to search for two state names instead of one:

Code: Select all

bci_dat2stream --transmit-s < S001R01.dat | bci_stream2asc | grep "Feedback|Running" > feedback.txt
Juergen

Re: State saving in text file

Posted: 02 Feb 2012, 12:18
by vladi
Hallo,

now I'm trying to extract EEG data from the dat file into a text file and I'm not sure which string I can use for the extraction. Because when I want to exract some parametrs I can use their names like in:

bci_dat2stream --transmit-s < S001R01.dat | bci_stream2asc | findstr "feedback" > feedback.txt
But how to go for the signal I have no idea. Would be great if you could help me out again.

Greetings,
Vladi

Re: State saving in text file

Posted: 02 Feb 2012, 14:03
by mellinger
Hi,

use the BCI2000Export tool for this purpose. It is located inside the BCI2000/tools directory. From the drop-down menu, choose one of the ASCII options.

Regards,
Juergen