| Re: read_ascii for many rows / possible to create automatic names for variables [message #57152 is a reply to message #57149] |
Wed, 05 December 2007 06:05   |
britta.mey
Messages: 14 Registered: August 2007
|
Junior Member |
|
|
On Dec 5, 2:55 pm, David Fanning <n...@dfanning.com> wrote:
> bmey writes:
>> as output from a spectrometer i obtain an ascii-file with many (more
>> than 1024) columns and a few hundred rows. Most of the columns (1024
>> of them) refer to a specific pixel of the spectrometer.
>> Is there an effective way to read this file and to obtain each column
>> as own variable? I do not want to type an own name for each of the
>> columns, so i hope that there is a way to have a "dynamic name".
>
>> Something like:
>
>> data=read_ascii(file) & data=data.(0)
>
>> pixel1=data(4,*)
>> pixel2=data(5,*)
>> ....
>> pixel1024=data(1027,*)
>
>> But to have idl to count from 1 to 1024.
>
>> I hope it is possible to understand what i want to do.
>
> I think you ought to be SURE that's what you want. It
> doesn't sound like a good idea to me. Just read the
> data all at once, and you have any column you like,
> just as an index into the data array.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Hello,
i'm still a beginner in programming, therefore the next question. When
i read the whole array, how can i then proceed? I want to calculate
for each pixel (each column) the arithmetic mean of the values and
store these mean values as a new variable.
Until now i have only worked with only few columns, the readf command
and then continued with these (1,*)-dimensional arrays.
Thank you for your help,
Britta
|
|
|
|