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 #57312 is a reply to message #57153] Wed, 05 December 2007 09:57 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Britta writes:

> Great, thank's a lot. This works. Could you please short explain what
> you have done? Or please tell me, if this is correct, what I
> understood...
>
> parts = StrSplit(line, '[ ' + String(9B) + ']+', /REGEX, /EXTRACT)
>
> Here you separate the string of the first line into substrings (in the
> previous version you told IDL with (.., ' ',..) that a blank charakter
> is the separator, correct?), and the part '[ ' + String(9B) + ']+', /
> REGEX, means that the pattern of the ascii file contains not only
> blank characters but any combination of blank characters and tabs. Am
> I right up to here?

Yes, you understand perfectly so far.

> So IDL moves forward starting from one column until the binary code is
> different from the code of a blank character or a tab and "knows" that
> there is the next column.

Well, you give IDL too much credit. :-)

I would say that what I am doing is separating the first line of
the file into "parts", based on finding either a blank character
or a tab character. I simply count the number of parts I find
and use that as a surrogate for the number of columns in the
file. This usually works brilliantly with just looking for
blank characters, but perhaps a better solution is to look
for all "white space characters". If we use the IDL definition,
we might look for blank characters, tabs, and commas. That way
we would pretty much cover all the bases. But mixing tabs and
spaces in a line!? Never seen that before.

> I wish you a nice day (for me it's time to leave off work).

Alas, I've got to work until midnight to make up all the time
I've lost fooling around here this morning. :-(

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.")
[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 14:08:14 PDT 2025

Total time taken to generate the page: 1.68043 seconds