I have a data output from a device in a form of a string. I need to transform it into such a form that I can work with it, such as plot columns with respect to one another and such. After a apply Characters
to it it takes the form:
lst={" ", " ", " ", "1", "6", ".", "4", "1", "0", "7", " ", " ", " ", " \
", " ", " ", " ", " ", " ", " ", " ", "4", ".", "4", "3", "1", "5", \
"e", "-", "0", "1", " ", " ", " ", " ", " ", " ", " ", "5", ".", "4", \
"0", "0", "7", "e", "+", "0", "2", " ", " ", " ", " ", " ", " ", "1", \
".", "9", "8", "3", "8", "e", "-", "0", "1", " ", " ", " ", " ", " ", \
" ", " ", "2", ".", "4", "1", "7", "7", "e", "+", "0", "2", " ", " ", \
" ", " ", " ", " ", " ", "7", ".", "4", "8", "4", "5", "e", "+", "0", \
"0", " ", " ", " ", " ", " ", " ", " ", "9", ".", "1", "2", "1", "5", \
"e", "+", "0", "3", "\\n", " ", " ", " ", " ", " ", " ", "1", "8", \
".", "6", "8", "2", "5", " ", " ", " ", " ", " ", " ", " ", " ", " ", \
" ", " ", "1", ".", "2", "2", "0", "1", "e", "+", "0", "0", " ", " ", \
" ", " ", " ", " ", " ", "1", ".", "3", "7", "1", "8", "e", "+", "0", \
"3", " ", " ", " ", " ", " ", " ", "3", ".", "3", "6", "3", "5", "e", \
"-", "0", "1", " ", " ", " ", " ", " ", " ", " ", "3", ".", "6", "0", \
"0", "7", "e", "+", "0", "2", " ", " ", " ", " ", " ", " ", " ", "1", \
".", "4", "4", "5", "1", "e", "+", "0", "1", " ", " ", " ", " ", " ", \
" ", " ", "1", ".", "5", "4", "7", "0", "e", "+", "0", "4", "\\n", " \
", " ", " ", " ", " ", " "}
This is a small part of the data.
StringJoin
yields 7 columns, which is how the data is organized
So, any idea of how to transform it into a normal list?
Later edit: to address the question of bbgodfrey: this is a part of the original output. I add it as an image:
After I transformed in into characters and cut away first 1360 ones containing the useless billhead, and then combine them back to the string we see 7 columns with numbers that I already posted above.
SemanticImportString[StringJoin@StringDelete[lst, "\\n"]]
. This will give you aDataset
from which you could get your data, and possiblyPartition
the result into a usable table. $\endgroup${16.4107, 4.4315e-01, …}
? $\endgroup$Awk
,Perl
or similars $\endgroup$Awk
is easier,Perl
is more modern and powerful. Google them :) $\endgroup$