MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: List as variable

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

  • Prev by Date: HTML export
  • Next by Date: Newbie needs help with 3D plot
  • Prev by thread: RE: List as variable
  • Next by thread: Which Communications to Use for MathLink on NT?