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

Home » Public Forums » archive » Writing a modified .txt file issue
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: Writing a modified .txt file issue [message #85383 is a reply to message #85382] Mon, 29 July 2013 21:42 Go to previous messageGo to previous message
Heinz Stege is currently offline  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
[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: Find all user-defined structure definitions
Next Topic: Multiple plots with plot function

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

Current Time: Mon Oct 13 13:55:44 PDT 2025

Total time taken to generate the page: 1.12148 seconds