Re: Writing a modified .txt file issue [message #85383 is a reply to message #85382] |
Mon, 29 July 2013 21:42   |
Heinz Stege
Messages: 189 Registered: January 2003
|
Senior Member |
|
|
Good Morning David,
the reason is, that there are tabs (9b) instead of blanks (32b) in
your text file. Only the first two columns are separated by a tab
which is followed by a blank.
That makes pos=strpos(word,' ') to be -1 after extracting the first
column. That, what your eyes see as column 2 to 5 is not splitted
within the loop. It remains as one column in the word array.
When IDL converts this strings to floating point, it quietly ignores
all the stuff right of the first tab. For example
help,float('12.25 14 39.16 12.06')
prints
<Expression> FLOAT = 12.2500
on the screen.
Do you have a string-replace-routine within your coyote library to
replace all tabs within a string array by blanks? If yes, use it.
If not, you can replace
pos=strpos(word,' ')
in line 21 by
pos=ulong(strpos(word,' ')) < ulong(strpos(word,string(9b)))
and you will get the expected result. But please, don't blame me to
make cryptic code. ;-)
The ulong function above is used to change -1 to a very big number.
The replacement line returns the position of the next blank or the
next tab, depending on what is more left.
Cheers, Heinz
|
|
|