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

Home » Public Forums » archive » Re: read_ascii for many rows / possible to create automatic names for variables
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: read_ascii for many rows / possible to create automatic names for variables [message #57139 is a reply to message #57138] Wed, 05 December 2007 07:57 Go to previous messageGo to previous message
britta.mey is currently offline  britta.mey
Messages: 14
Registered: August 2007
Junior Member
On Dec 5, 4:40 pm, David Fanning <n...@dfanning.com> wrote:
> Britta writes:
>> The first column are seconds, second column - hour, third - minutes,
>> fourth - seconds (if idl doesn't count column 2 to 4 as one column) ,
>> sixth to tenth - data output from the spectrometer. The result of
>> colMeans(6) should be approximately 136 (more or less :-), in the
>> original file there are a lot more columns and also more rows). For
>> print, colMeans(6) i obtain 1974.44. :-(
>
> Well, if I take the data you sent me, and I run the program
> I sent you, then this is what I get:
>
> IDL> print, colmeans(6)
> 135.808
>
> So, I don't know what the problem might be.
>
> You will have a problem with that first column, since IDL won't
> read a number with two decimal points in it, but that is not
> changing things otherwise, and if you are not using the first
> column, I wouldn't worry about it.
>
>> Is the value 2 in colMeans = Total(data, 2)/rows the number of
>> dimensions? Why do i use 2? To obtain a 1-dimensional array (scalar)
>> as a result?
>
> The two indicates that the total should be obtained over the
> 2nd dimension. That is, over the rows. In other words, add up
> the values in the columns.
>
>> I'm quite sure that these are really stupid questions for you, so
>> thank you for your patience.
>
> No, the stupid questions I refuse to answer. :-)
>
> 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.")

Hi,

this really confuses me. Sometimes i think i have a bad aura
concerning computers :-). If you agree I would send you the original
file for a short test, because at the moment i have no idea what my
mistake is.

The syntax I use is the copy of your suggestion (see below):

------------------------------------------------------------ ---
rows = File_Lines('PATH\FILENAME.dat')
Openr, lun, 'PATH\FILENAME.dat', /Get_Lun
line = ""
ReadF, lun, line
cols = N_Elements(STRSPlit(line, ' ', /Extract))
Point_lun, lun, 0
data = FltArr(cols, rows)
ReadF, lun, data
Free_Lun, lun

colMeans = Total(data, 2)/rows

print, colMeans(6)

end
------------------------------------------------------------ --------

Cheers,

Britta
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: array operations and memory consumption
Next Topic: pson + !p.multi + xyouts

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

Current Time: Sat Oct 11 00:33:18 PDT 2025

Total time taken to generate the page: 2.40191 seconds