MathGroup Archive 2002

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

Search the Archive

FW: Re: the fastest way to read binary files

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

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 usm.maine.edu]
To: mathgroup at smc.vnet.net
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];
Close[strm];

Mariusz


--
===============================
Mariusz Jankowski
University of Southern Maine
mjkcc at usm.maine.edu
207-780-5580


"Raf" <r_a_f at yahoo.it> wrote in message news:a79dm0$a4l$1 at smc.vnet.net...
> 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,
seems
> to be better than BinaryImport), but when i use this command...
> data = ReadList[filePath, Byte]
> ....it 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