Re: readcol problems [message #49492] |
Wed, 02 August 2006 07:38 |
Haje Korth
Messages: 651 Registered: May 1997
|
Senior Member |
|
|
Amanda,
hm, not sure where you found readcol, but it's not part of the IDL
distribution. If you insist on using it, you need to contact the
original author to supply the numlines function to you. Otherwise it's
pretty simple to construct your won reader. E.g.:
pro readfile,fname,data
ndat=file_lines(fname)
data_struct={x:0.0,y:0.0}
data=replicate(data_struct,ndat)
openr,runit,fname,/get_lun
readf,runit,data
close,runit
free_lun,runit
return
end
Then do
plot,data.x,data.y
Cheers,
Haje
Amanda wrote:
> I'm pretty new to IDL and don't know much about it.
>
> I'm trying to use the readcol function but I keep getting errors
> "variable
> is undefined", "attempt to call undefined procedure/function:
> 'NUMLINES'"
> and sometimes it can't seem to find my .dat file. I'm guessing I must
> be
> missing some horribly obvious line to get the "variable undefined"
> error
> but I don't know why I keep getting the Numlines error. I don't need it
> to count the number of lines, I just want to plot x against y.
>
> I'm using a windows version and this is the code I'm using:
>
> PRO test, x, y
>
> readcol, 'test.dat', x, y, f='f,f,'
>
> plot, x, y, psym=2
>
> END
>
> Any help would be greatly appreciated. :)
|
|
|