Re: accessing data from READ_ASCII [message #39513] |
Wed, 26 May 2004 06:53  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Andreas Ernst writes:
> 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?
When I read your example data with the code you supply
above the variable "sig" is a structure containing one
field, FIELD01, which is a 14 by 3 float array. The
third column would then be:
col3 = reform((sig.(0))[2,*])
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: accessing data from READ_ASCII [message #39609 is a reply to message #39513] |
Wed, 26 May 2004 07:34  |
Andreas Ernst
Messages: 14 Registered: July 2002
|
Junior Member |
|
|
David Fanning wrote:
>
> When I read your example data with the code you supply
> above the variable "sig" is a structure containing one
> field, FIELD01, which is a 14 by 3 float array. The
> third column would then be:
>
> col3 = reform((sig.(0))[2,*])
>
> Cheers,
>
> David
>
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.
Andreas
|
|
|