Re: the fastest way to read binary files
- To: mathgroup at smc.vnet.net
- Subject: [mg33489] Re: the fastest way to read binary files
- From: "Mariusz Jankowski" <mjkcc at usm.maine.edu>
- Date: Fri, 22 Mar 2002 04:08:20 -0500 (EST)
- References: <a79dm0$a4l$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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 > >