comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Help needed with reading ASCII data
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Help needed with reading ASCII data [message #18132 is a reply to message #18131] Fri, 03 December 1999 00:00 Go to previous messageGo to previous message
John Keck is currently offline  John Keck
Messages: 10
Registered: August 1996
Junior Member
> I'm completely new to IDL, and I have a set of data in ASCII format. It
> is extracted from MRI data. It is a file which contains 3 columns of
> data. The first column is the x, the second is the y coordinate and the
> third is just a scaled magnitude value between 0 and 1. There are 38808
> rows of data, and the matrix size is (49, 36) and there are 22 time
> phases. I want to know if anyone has had experience in reading in data
> of this type, and how to put it into an array that can be read by IDL.

Dear Scott,

The easier thing to do (programming-wise) is to use the READCOL
procedure, which I believe is part of one of the standard libraries that
you can download (you can search these libraries from
http://www.astro.washington.edu/deutsch/idl/htmlhelp/index.h tml)

Your data file is a bit big though, so that may take quite a while.
I've found a much faster way to read in big files is to set up a
structure and a print-type format to read in the data. Something like
this:

filename = "foo.dat"
fmt = "(i3,3F7.2)" ; of course this has to match the format of your
columns

cog = {det $
,t: 0 $
,x: 0. $
,y: 0. $
,z: 0.)

all = REPLICATE(cog,nl) ; NL = # lines in file

OPENR,lun,/GET_LUN,filename
READF,lun, FORMAT=fmt,all
FREE_LUN,lun
END

Anyway, that should read in your file at one blow. You can then
re-arrange the data in your arrays as you like. (You may want to look
up the IDL help files on structures; it might be helpful to know that
you can address the fields of a structure with numbers and can to a
large extent treat a structure as an array.)

I hope that's helpful.

Sincerely,

John Keck
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: do I really need to use loops on objects?
Next Topic: POLYFILLV for 3D to create volumes

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 18:41:14 PDT 2025

Total time taken to generate the page: 0.88123 seconds