Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1571

Importing text file as machine-precision array

From Sidney Cadot <sidney@jigsaw.nl>
Newsgroups comp.soft-sys.math.mathematica
Subject Importing text file as machine-precision array
Date 2011-04-09 11:29 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <inpfu3$9as$1@smc.vnet.net> (permalink)

Show all headers | View raw


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.

Back to comp.soft-sys.math.mathematica | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Importing text file as machine-precision array Sidney Cadot <sidney@jigsaw.nl> - 2011-04-09 11:29 +0000
  Re: Importing text file as machine-precision array David Bailey <dave@removedbailey.co.uk> - 2011-04-09 22:00 +0000
    Re: Importing text file as machine-precision array Sidney Cadot <sidney.cadot@gmail.com> - 2011-04-11 11:05 +0000
      Re: Importing text file as machine-precision array David Bailey <dave@removedbailey.co.uk> - 2011-04-17 11:53 +0000

csiph-web