[Haskell-cafe] Data import from octave / text file
kaffeepause73
kaffeepause73 at yahoo.de
Wed Jun 15 13:13:49 CEST 2011
Dear all,
I want to read numeric data in vector / matrix format generated by octave.
As I haven't seen any octave specific libraries yet (only matlab), I'm
tyrying the way via ascii - file.
The folloing file log.txt contains three signal traces in the three columns
(time, signal 1, signal 2)
0 30 9
0.1 30 9
0.2 30 9
0.3 30 9
0.4 30 9
0.5 30 9
0.6000000000000001 30 9
0.7000000000000001 30 9
0.8 30 9
0.9 30 9
1 30 9
I got the following bit of code compiled with ghc:
import System.IO
main = do
text <- readFile "./log.txt"
putStrLn text
putStrLn "SecondLot"
let m = read text :: [[Double]]
putStrLn (show m)
putStrLn "Finish"
Reading text works, but not reading text into m. The Output:
0 30 9
0.1 30 9
0.2 30 9
0.3 30 9
0.4 30 9
0.5 30 9
0.6000000000000001 30 9
0.7000000000000001 30 9
0.8 30 9
0.9 30 9
1 30 9
SecondLot
signalImport: Prelude.read: no parse
Any suggestions ? - Thanks in advance.
--
View this message in context: http://haskell.1045720.n5.nabble.com/Data-import-from-octave-text-file-tp4490870p4490870.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list