MathGroup Archive 1998

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

Search the Archive

Re: Importing external grid file to do contour plot


In article <6nc6vu$fbb at smc.vnet.net>, shon at vt.edu (Sophie Hon) wrote:

> I'm trying to read an outside grid file into Mathematica in order to do
> a contour plot.  It's a 50 by 50 grid, so that the data is arranged as
> 50 strings of 50 numbers.
> Here is what I have so far, which I know does not work:
> 
> ReadList["Macintosh HD:Mathematica 3.0 Files:fish:aqc.grd",
> Array[Number,{50,50}]]
> 
> I would appreciate your help very much. Sincerely,
> Sophie Hon.


Hi Sophie,

Its is not clear what you mean by a "string" of numbers. If I assume
that you just mean 50 lines separated by carrage returns of  50 numbers
on a line each separated by a space, then the one of the following
should work:

(1)
result=ReadList["Macintosh HD:Mathematica 3.0 Files:fish:aqc.grd",
Number];

result = Partition[result,50];

(2)

result=ReadList["Macintosh HD:Mathematica 3.0 Files:fish:aqc.grd",
Number, RecordLists->True];



Note that

In[1]:=
Array[Number,{2,2}]

Out[1]=
{{Number[1,1],Number[1,2]},{Number[2,1],Number[2,2]}}

which is not what you want. But,

In[2]:=
Table[Number,{i,2},{j,2}]

Out[2]=
{{Number,Number},{Number,Number}}

may be more what you are thinking of, so that the following should work
as well:


(3)

result=ReadList["Macintosh HD:Mathematica 3.0 Files:fish:aqc.grd",
Table[Number,{i,50},{j,50}]];


Regards,

David

-- 
David Reiss
dreissNOSPAM at nospam.earthlink.net
http://home.earthlink.net/~dreiss
To send personal email, remove the words  "nospam" and "NOSPAM" from the
email address


  • Prev by Date: kernel problem
  • Next by Date: Re: Mathematica books
  • Previous by thread: Re: Importing external grid file to do contour plot
  • Next by thread: Re: Importing external grid file to do contour plot