[Haskell-cafe] Data import from octave / text file

kaffeepause73 kaffeepause73 at yahoo.de
Wed Jun 15 14:59:26 CEST 2011

Hey guys,

thanks for the very quick help. The code works and looks like:
(any tips regards speed and memory usage ?)  
import System.IO
import Data.Array
import Data.Packed.Matrix

parse :: String -> [[Double]] -- expects plainer syntax
parse = map (map read . words) . lines

main = do 
     -- read and show plain text
     text <- readFile "./log.txt" 
     putStrLn text 
     -- read and show parsed list of lists
     putStrLn "parsed list of lists"
     let m = parse text 
     putStrLn (show m) 
     -- convert to matrix and show
     let a = fromLists m    
     putStrLn (show a) 
     -- cuts out first row to get signal
     let t = takeColumns 1 a
     putStrLn (show t)

     putStrLn "Finish"

View this message in context: http://haskell.1045720.n5.nabble.com/Data-import-from-octave-text-file-tp4490870p4491136.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list