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 #18140 is a reply to message #18131] Fri, 03 December 1999 00:00 Go to previous message
Bernard Puc is currently offline  Bernard Puc
Messages: 65
Registered: January 1998
Member
Scott Reid wrote:
>
> Hi All
>
> 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.

I typically do something like this when reading delimited ASCII data.
Each line is read into a string and then the string is divided into an
array of strings. Then you do what you will with the values in the
array:

OPENR,Lun,/Get_Lun,Filename
sString = ''
WHILE NOT(EOF(Lun)) DO BEGIN
READF,Lun,sString
tempArray = str_sep(sString, string(byte(32))) ;Replace with ASCII code
of delimiter
index = WHERE( tempArray NE '', num)
IF num GT 0 THEN tempArray = tempArray[index]

x = float(tempArray[0])
y = float(tempArray[1])
s = float(tempArray[2])
;You would assign these values to fill your array: fltarr(49,36,22)

END

--
Bernard Puc AETC, INC.
bpuc@va.aetc.com 1225 Jefferson Davis Highway #800
(703) 413-0500 Arlington, VA 22202
[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: Sun Oct 12 09:44:00 PDT 2025

Total time taken to generate the page: 0.24125 seconds