Re: Data handling in mathematica 2.2 and 3.0
- To: mathgroup at smc.vnet.net
- Subject: [mg5680] Re: [mg5662] Data handling in mathematica 2.2 and 3.0
- From: b5hafa at rz.uni-jena.de (Fabian Haas)
- Date: Tue, 7 Jan 1997 11:22:56 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Some time ago sean ross <sean at lorien.creol.ucf.edu> wrote:
> How can I get mathematica to read in a text data file without
>first having to massage the data in a text editor? Take your
>typical multi-column data from an excel-type spreadsheet. If I
>save it as text, the ReadList function assumes I want to
>multiply all numbers together than appear on the same line. If
>I save it as comma delimited, ReadList says it is a syntax
>error. I have tried manipulating the RecordSeparator and
>WordSeparator options in ReadList, but no success.
> My current wordaround is to take the data file, read it into
>excel and save it as comma delimited text, then import it into
>word, and do a global replace on all return characters
>converting them into commas, placing a { } around the list,
>saving it as unformatted text. Then ReadList can read the data
>and I can Partition it. I hope there is a more elegant
>solution.
> P.S. Has anybody been able to figure out how to read in
>bitmap data like in the cat picture in the 3.0 "tour of
>mathematica"? Any time I try to read in .bmp files, it just
>generates garbage. Not quite as "mathematica reads in data in
>any format" advertised.
Well, that stuff is a bit tricky indeed, everthing must be set correctly,
Directory, data typ etc.
However, I dont thing you dont have to massage the text. Following code
works perfect im my case. The data file should not be a Word file but a
ASCII with line separators.
The data file:
93.4499 126.6742 157.2603 0.0018 19.0000 19
92.4422 126.3922 159.4079 0.0017 20.0000 20
91.4347 126.1202 161.8426 0.0017 21.0000 21
90.5665 125.8864 164.3282 0.0016 22.0000 22
89.9471 125.7135 166.6214 0.0016 23.0000 23
89.6368 125.6197 168.5002 0.0016 24.0000 24
89.6434 125.6106 169.8283 0.0016 25.0000 25
89.9323 125.6782 170.5657 0.0017 26.0000 26
90.4428 125.7964 170.7729 0.0018 27.0000 27
91.0992 125.9338 170.5774 0.0018 28.0000 28
91.8375 126.0542 170.1432 0.0018 29.0000 29
92.6062 126.1296 169.6212 0.0018 30.0000 30
93.3751 126.1468 169.1102 0.0017 31.0000 31
94.1427 126.1177 168.6390 0.0017 32.0000 32
94.9258 126.0668 168.1776 0.0016 33.0000 33
95.7526 126.0386 167.6544 0.0016 34.0000 34
96.6555 126.0793 166.9890 0.0016 35.0000 35
97.6514 126.2293 166.1272 0.0017 36.0000 36
98.7383 126.5062 165.0630 0.0018 37.0000 37
with a Return at the end and SPACES betwenn the numbers, however, should
work wirth commas as well.
The reading code:
Reading of Data
Clear[data, koordata, koortest];
SetDirectory["Macintosh HD:R=FCdiger"];
filenames =3D { "SCHNABEL.050", "KOPF-LI.050", "KOPF-RE.050", =
"RUMPFLI.050", "RUMPFRE.050", "RUMPFHI.050", "SCHWA-LI.050", "SCHWA-RE.05
0",
"S-SPI-LI.050", "S-SPI-RE.050", "HANDGERE.050",
"FL-SP-RE.050", "SPI-3-RE.050", "HAND10RE.050",
"FL-SP-LI.050", "SPI-3-LI.050", "HAND10LI.050",
"HANDGELI.050", "SCHWA-MI.050", "SP-BSCHL.050" };
(* List all all needed files *)
data =3D Table[
ReadList[ filenames[[s]], Number, RecordLists->True],
{s, 1, Length[filenames]}];
(* Reads all files, one after the other *)
ResetDirectory[];
I hope that helps a little. If not, why not send me you original files, so I
can try myself.
Cheers
=46abian
-------------------------------------------------------------------------
Dipl.Biol. Fabian Haas, MPhil
Institut f=FCr Spezielle Zoologie und Evolutionsbiologie
Erbertstr. 1
D-07743 Jena
Deutschland / Germany
TEL ++ 49 361 630 424
=46AX ++ 49 361 630 392
:-) (-:
-------------------------------------------------------------------------