State saving in text file

Forum for software developers to discuss BCI2000 software development
Locked
vladi
Posts: 18
Joined: 04 Jan 2012, 08:29

State saving in text file

Post by vladi » 25 Jan 2012, 08:23

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

mellinger
Posts: 1210
Joined: 12 Feb 2003, 11:06

Re: State saving in text file

Post by mellinger » 25 Jan 2012, 09:15

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

vladi
Posts: 18
Joined: 04 Jan 2012, 08:29

Re: State saving in text file

Post by vladi » 26 Jan 2012, 06:13

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

mellinger
Posts: 1210
Joined: 12 Feb 2003, 11:06

Re: State saving in text file

Post by mellinger » 30 Jan 2012, 08:30

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

vladi
Posts: 18
Joined: 04 Jan 2012, 08:29

Re: State saving in text file

Post by vladi » 02 Feb 2012, 12:18

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

mellinger
Posts: 1210
Joined: 12 Feb 2003, 11:06

Re: State saving in text file

Post by mellinger » 02 Feb 2012, 14:03

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

Locked

Who is online

Users browsing this forum: No registered users and 15 guests