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

Home » Public Forums » archive » Re: IDL and me!
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: IDL and me! [message #45560 is a reply to message #45559] Wed, 21 September 2005 08:11 Go to previous messageGo to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
Liberum wrote:
> Hi Guys and Gals,
>
> As a nascent IDL user I have come across a little problem that really
> chaps my hide! Any help would really be appreciated!
> Consider the following file-reading code:
>
> OPENR, LUN, file, /GET_LUN
> s = ""
> FOR i = 0, n_lines -1 DO BEGIN
> READF, LUN, s ; reads the file line by line into string s
> d = STRSPLIT(s, /EXTRACT)
> col1 = d[0] & col2 = d[1] & col3 = d[2] & col4 = d[3]
> IF FIX(col1) EQ -10 THEN bias[i] = 0
> IF FIX(col1) EQ -5 THEN bias[i] = 1
> IF FIX(col1) EQ -1 THEN bias[i] = 2
> IF FIX(col1) EQ 0 THEN bias[i] = 3
> IF FIX(col1) EQ 1 THEN bias[i] = 4
> IF FIX(col1) EQ 5 THEN bias[i] = 5
> IF FIX(col1) EQ 10 THEN bias[i] = 6
> cth[i] = LONG(col2)
> occur[i] = LONG(col3)
> pixels[i] = LONG(col4)
> hist_data[bias[i], cth[i] - 1] = FLOAT(occur[i])/pixels[i]*100.
> i += 1
> ENDFOR
> FREE_LUN, LUN
>
> Now all I'm trying to do is to read the contents of this file into an
> array. Now when I run this script I get:
>
> % Attempt to subscript D with <INT ( 1)> is out of range.
>
> Now how can this be when d has 4 elements and I have not looped outside
> of [0, 3] ????????????
>
> Sincerely,
> Lib
>

Perhaps ASCII_TEMPLATE can be useful for you.

--
-----------------------------------------------------
Antonio Santiago P�rez
( email: santiago<<at>>grahi.upc.edu )
( www: http://www.grahi.upc.edu/santiago )
( www: http://asantiago.blogsite.org )
-----------------------------------------------------
GRAHI - Grup de Recerca Aplicada en Hidrometeorologia
Universitat Polit�cnica de Catalunya
-----------------------------------------------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Gaussian Enhancement on Image Histogram
Next Topic: Map Projections with User Defined Ellipsoids (Mars)

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

Current Time: Fri Oct 10 08:35:33 PDT 2025

Total time taken to generate the page: 0.31860 seconds