MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

FW: Re: the fastest way to read binary files

  • To: mathgroup at
  • Subject: [mg36990] FW: [mg33489] Re: the fastest way to read binary files
  • From: Blimbaum Jerry DLPC <BlimbaumJE at>
  • Date: Fri, 4 Oct 2002 05:01:34 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Please ignore a similar question I just posted about BinaryImport...I forgot
I had saved this email....would like to share this....BinaryImport took over
an hour to import 16 MByte file, whereas this technique took less then 5
seconds...special thanks to Mariusz...

jerry blimbaum  NSWC panama city, fl

-----Original Message-----
From: Mariusz Jankowski [mailto:mjkcc at]
To: mathgroup at
Subject: [mg36990] [mg33489] Re: the fastest way to read binary files

ReadList is indeed the fastest. To correctly read a file on a Windows system
you must change a DOSTextFormat option. The following shows how:

strm=OpenRead["filename", DOSTextFormat->False];
data=ReadList[strm, Byte];


Mariusz Jankowski
University of Southern Maine
mjkcc at

"Raf" <r_a_f at> wrote in message news:a79dm0$a4l$1 at
> Hi MathGroup.
> The question:
> What is the fastest way to read binary files in Mathematica 4.0 ?
> I think the fastest is with ReadList (indeed ReadSounFile that use it,
> to be better than BinaryImport), but when i use this command...
> data = ReadList[filePath, Byte]
> doesn't read whole file; can somebody tell me the reason?
> Thanks for your attention,
> regards,
> Raf.
> P.S.:
> I made some simple tests (@ 16 bit):
> << Experimental`
> data = BinaryImport[fileRawPath, Table["Integer16", {4000}],
> ByteOrdering -> -1];    => 10 seconds
> data = ReadListBinary[fileRawPath, SignedInt16, ByteOrder ->
> LeastSignificantByteFirst];    = > 26 seconds
> << Miscellaneous`Audio`
> data = ReadSoundfile[fileWavPath]     => 1.54 seconds

  • Prev by Date: RE: Mathematica stole my X so I had to kill it
  • Next by Date: Re: Accuracy and Precision
  • Previous by thread: Re: How much graphics RAM?
  • Next by thread: Plotting ellipses and other functions