Re: List as variable
- To: mathgroup@smc.vnet.net
- Subject: [mg11988] Re: [mg11938] List as variable
- From: Tomas Gargz <tgarza@mail.internet.com.mx>
- Date: Fri, 17 Apr 1998 03:40:25 -0400
A. T. Roach wrote: > I am a newcomer to Mathematica and am having a little trouble reading in > a file. I can get > In[1]:= ReadList["flnm",RecordLists->True,Numbers] to read in a file and > make a list, but I don't quite understand how to put that list into a > variable so that I can work on it. When I try something simplistic like > In[2]:= data=ReadList["flnm",RecordLists->True,Numbers] > I just get > Out[2]=ReadList["flnm",RecordLists->True,Numbers] > and > In[3]:=data > Out[3]=data Well, I think you're doing the right thing. This is how I read files and it works allright. Doing In[1]:= ReadList["flnm",RecordLists->True,Numbers] should return the list flnm and print it below. Sometimes I assign the name before, as in In[2]:= data=ReadList["flnm",RecordLists->True,Numbers] but I may also assign the names afterwards, as in In[3]:= ReadList["flnm",RecordLists->True,Numbers] ; In[4]:= data = %; Check first if your file "flnm" is not empty, using In[5]:= !! flnm Good luck, Tomas Garza Mexico City