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

> Thank you, the file is on its way.

Ah, well, ain't that interesting!

The problem here is that while *most* of your columns
are separated by blank characters, two of your columns
are separated by tabs. What this basically means is that
you should find a gun and shoot the person who created
this data file. :-)

What is happening is that I used a blank character as
the separator for calculating the number of columns in
the file, and because of the two tabs, I come up two
columns short in the calculation. I calculate 1030 and
there are really 1032. Thus, my columns are totally
messed up, and I never read all the data in the file.

So, since these data files are probably identical from one
run to the next, you could probably just use the number 1032
for the number of columns and the code would work perfectly.

The other alternative (besides shooting the programmer,
I mean) is to use a regular expression as the column
separator in StrSplit. As you are a beginner, and as this
is something even I don't understand, we will leave it
to our betters to fill us in on how THIS can be done. :-)

My best guess is that it is something like this:

parts = StrSplit(line, '[ ' + String(9B) + ']+', /REGEX, /EXTRACT)
cols = N_Elements(parts)

Hope that helps. I haven't see *this* problem before. :-)

Cheers,

David

P.S. It looks to me like I got that expression right from the
quick test I just ran.
--
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 00:33:58 PDT 2025

Total time taken to generate the page: 1.12231 seconds