accessing data from READ_ASCII [message #39515] |
Wed, 26 May 2004 05:59  |
Andreas Ernst
Messages: 14 Registered: July 2002
|
Junior Member |
|
|
Hi,
I am today trying to read a file with formatted data,
which look like this:
0.0 SIGT2: 2.15D-01 1.75D-01 2.15D-01 2.13D-01 2.08D-01
2.10D-01 1.95D-01 2.08D-01 1.83D-01 1.56D-01 9.23D-02 2.08D-01
1.0 SIGT2: 2.15D-01 2.05D-01 2.18D-01 2.15D-01 2.11D-01
2.18D-01 2.16D-01 1.99D-01 1.91D-01 1.54D-01 9.04D-02 2.09D-01
2.0 SIGT2: 1.95D-01 2.46D-01 2.10D-01 2.48D-01 2.27D-01
2.17D-01 2.14D-01 2.05D-01 1.88D-01 1.54D-01 8.78D-02 2.33D-01
...
So the file contains basically 1500 lines with 14 columns of data,
from which the second column contains strings, which I don't need.
I tried to read it with the READ_ASCII routine, but I did not find
out how to acces the data structure afterwards. My code looks like
this:
sigc = FLTARR(till1)
sig=READ_ASCII(file1, num_records=till1)
sigc=REFORM(sig.(3))
PRINT, sigc[0]
till1 is 1500 in this case. sigc should contain the third
column of the data file, and as an example I would like to
print out the first datum in this column, which belongs to
the first row of data. I also tried the following expression
PRINT, (sig.(3))[0]
and
PRINT sig(3,0)
but neither of these possibilities works.
How to deal with that?
Thanks in advance. Andreas
|
|
|
Re: accessing data from READ_ASCII [message #39608 is a reply to message #39515] |
Wed, 26 May 2004 07:48  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Andreas Ernst writes:
> Thanks a lot, David. I was already trying half of the
> day. The idl documentation is very restricted concerning
> the question of accessing data structures...
> It only has the routines in it.
Yes, that's why it is helpful to know how to use
the HELP command so you can look around a little
bit yourself. :-)
Cheers,
David
P.S. Spend some time studying those keywords, too.
A number of them are essential (DEVICE, STRUCTURE,
SOURCE) and others are helpful.
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|