Can't get RecordSeparators t
- To: mathgroup at yoda.physics.unc.edu
- Subject: Can't get RecordSeparators t
- From: Simon Chandler <simonc at hpcpbla.bri.hp.com>
- Date: Thu, 13 Aug 92 19:57:03 +0100
Dear Mathematica users,
I have a need for mma to read a text file containing some expressions
(not necessarily numbers) separated by commas i.e.,
"1,2,3,4,5"
(Excluding the "")
To do this I tried ReadList[filename,RecordSeparators->{","}]
However, this gave me an error
Read::readt: syntax error reading 1,2,3,4,5 from filename
In fact I couldn't get RecordSeparator to work with anything other
than a newline character. To demonstrate this try the following...
In[1]:=
delimiter="\.2c";
WriteString["testfile",1,delimiter,2,delimiter,3,delimiter,4,delimiter,5];
!! testfile
1,2,3,4,5
In[2]:=
ReadList["testfile",RecordSeparators->{delimiter}]
Read::readt: Syntax error reading 1,2,3,4,5 from test11.
Out[2]=
{$Failed}
Then try using a newline delimiter "\.0d". Also try "\.89" for example.
Where's my silly mistake ??????
Thanks in advance for your help,
Simon Chandler
Hewlett-Packard Ltd (CPB)
Filton Road
Stoke Gifford
Bristol
BS12 6QZ
Tel: 0272 228109
Fax: 0272 236091
email: simonc at hpcpbla.bri.hp.com