TRYING to read ASCII data with Mathematica
- Subject: [mg3079] TRYING to read ASCII data with Mathematica
- From: mek at guinan.arl.psu.edu (Mark E. Kotanchek)
- Date: 30 Jan 1996 05:04:25 -0600
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Penn State University, Center for Academic Computing
- Sender: daemon at wri.com
(Apologies for posting this here rather than *.soft-sys.*; however, I was hoping for a quick response before I lose the few remaining hairs on my scalp.) I have some sizable data files (>40MB) to which I'd like to apply some subspace processing algorithms. Alas, Mma is being quite adament about not letting me load the data in reasonable segments and, thereby, avoid running out of memory. I've been trying various permutations and currently have "the bible", Shaw&Tigg, Blachman's Quick Refernce, Gray's Mastering Mathematica, and Gayloard's Programming w/ Mma open on my desk as well as the function browser. After all that, I have no idea as to why I cannot achive my objective -- other than to assume some innate malevolence in Mma 2.2 when running under NEXTSTEP 3.3/Intel. That said, I have one small (2 MB) file I've been using as a test case and In[75]:= !!test15.mts yields the correct response of a three column by umpteen row ascii response: 97.957191 -1.1539974 -9207.8301 97.967194 -1.1536527 -8654.8857 97.977196 -1.1431384 -3954.8635 97.98719 -1.1343479 -997.78583 97.997192 -1.142449 -4124.4697 : After some fussing, I discovered that ReadList[deflectionFile,Real, RecordLists -> True, RecordSeparators -> {"\r"}] will read in the file. Alas, I cannot (nor, do I want to) handle the entire file in one humongous chunk. Thus, we try the approach... In[43]:= strm = OpenRead[deflectionFile] Read[strm,Real] Read[strm,Real] Read[strm,Real] Read[strm,Real] Close[strm] Out[43]= InputStream[test15.mts, 9] Out[44]= 97.957191 Out[45]= -1.1539974 Out[46]= -9207.8301 Out[47]= EndOfFile Out[48]= test15.mts along with the error message: From In[43]:= Read::readn: Syntax error reading a real number from test15.mts. Trying various options for RecordSeparators, etc. doesn't seem to do anything positive. I don't think what I'm trying to should be all that difficult; however, after fussing for three hours at what should be a trivial task I'm at wits end. Maybe I've just run into a "feature" of the NEXTSTEP/Intel version of Mma? (I hear a bug-fix version should be out in August!!) Thanks for any help, Mark. -- Dr. Mark Kotanchek Signal Processing Dept - 363 ASB Applied Research Lab/Penn State P.O. Box 30 State College, PA 16804 e-mail: kotanchek at psu.edu (NeXTmail, MIME-mail) TEL: (814)863-0682 FAX: (814)863-0753