Importing text file as machine-precision array
- To: mathgroup at smc.vnet.net
- Subject: [mg118037] Importing text file as machine-precision array
- From: Sidney Cadot <sidney at jigsaw.nl>
- Date: Sat, 9 Apr 2011 07:28:54 -0400 (EDT)
Hi all, I am trying to import a big text file containing non-sparse 2D numerical data into Mathematica. My aim is to get an array where the numbers are stored as machine-precision numbers. In other words, ByteCount[data] should be approximately equal to 8 times the number of table elements (assuming machine precision corresponds to 8-byte IEEE-754 numbers). If I do a straight data=Import["file","Table"], the file is parsed with all numbers represented as arbitrary precision floating point numbers; the data structure is ten times as big as it should be. If I do data=N[data] afterwards, the data is still four times as big as I would have expected. What is the appropriate way to accomplish what I want? Unfortunately, I cannot seem to find an option to Import[] to do this immediately when reading the data.