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

Home » Public Forums » archive » White space conversion (READS)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
White space conversion (READS) [message #9176] Tue, 10 June 1997 00:00
reuss is currently offline  reuss
Messages: 3
Registered: June 1997
Junior Member
I do not understand how IDL treats input fields consisting of white
space only when reading formatted data.

First I thought that IDL converts white space fileds to zeroes:

IDL> a = 0.0
IDL> b = 99.0
IDL> teststr = '6.0 '
IDL> reads,teststr,a,b,f='(f4.0,f6.0)'
IDL> print,a,b
6.00000 0.000000

Then I tried to read data from a table with white space for missing
values.
I read the lines as strings.
One line of data looks as follows:

; 1 2 3 4 5
;12345678901234567890123456789012345678901234567890123456789
;2 11234567890123 1 1123412123121234561234512345612345123456

1 F 92.178045955 S d 45.7 6.0

The scalar data variables are initialized to their respective data
types, then I try to read:

IDL> print,strlen(line)
60
IDL> reads,line,int1,str1,dbl1,str2,str3,int2,int3,int4,int5,flt1 ,$
IDL> flt2,flt3,flt4,flt5,$
IDL> f='(i2,1x,a1,f13.9,1x,a1,1x,a1,i4,i2,i3,i2,f6.2,f5.0,f6.0,f5 .0,f6.0)'
% Type conversion error: Unable to convert given STRING
to Float.
% Detected at: $MAIN$
% READS: End of input data encountered: LINE
% Execution halted at $MAIN$ (READS).
IDL> print,flt4
6.00000

Further inspection shows that the only variable not read correctly
is the last one, whereas the other white space fields have been
converted to zeroes.

Is this a bug, or have I made something wrong?
I use IDL 3.6.1 on a PC.

Yours,

Matthias Reuss
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problems in ENVI when calling a C function
Next Topic: IDL Expert Programmers Convention Coming Up

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

Current Time: Wed Oct 08 18:07:48 PDT 2025

Total time taken to generate the page: 0.00416 seconds