Errors when converting from bci2000 dat format to table form
Posted: 30 Apr 2014, 01:47
Ran into the following errors when executing the command
on some bci2000 files.
Also, is there any particular reason why bci_stream2table appends a hash (#) character to the header row and tab stops to the beginning of each line? This is kind of confusing.
For reference, here is the complete script that searches for .dat files in all subdirectories and converts them to tab-separated value files with the same name. Requires the fish shell and sponge.
Code: Select all
bci_dat2stream < myfile | bci_stream2table --output=mynewfile Code: Select all
subject4/EEG/subjectTM_4/TMsubject04S001R06.tsv
Runtime Error: Unhandled exception of type std::out_of_range: vector::_M_range_check
Aborting bci_stream2tableFor reference, here is the complete script that searches for .dat files in all subdirectories and converts them to tab-separated value files with the same name. Requires the fish shell and sponge.
Code: Select all
#!/usr/bin/fish
set filelist (ls **.dat)
# echo $filelist[1]
for infile in $filelist
set outfile (basename $infile .dat)
# echo $outfile".tsv"
# echo (dirname $infile)"/$outfile".tsv
set savefile (dirname $infile)"/$outfile".tsv
echo $savefile
bci_dat2stream < $infile | bci_stream2table --output=$savefile
# Remove single hash character from file start
# sed '1s/^.//' $savefile >> $savefile
# better method
tail -c +2 $savefile | sponge $savefile
# remove first character from each line
sed 's/^.//g' $savefile | sponge $savefile
end