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

Home » Public Forums » archive » How to select certain rows out of a file? THX A LOT!
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
How to select certain rows out of a file? THX A LOT! [message #76970] Wed, 20 July 2011 10:57 Go to next message
Tianyi Luo is currently offline  Tianyi Luo
Messages: 1
Registered: July 2011
Junior Member
Hi everyone,

I have a txt file which contains 900 rows of data, and in each row the
amount of values is not exactly the same. Now what I wanna do is to
select certain rows, say from the 90th to the 180th, and then try to
find a value out of the rows by a given index. Thank you guys!

Best regards

Tianyi Luo
Re: How to select certain rows out of a file? THX A LOT! [message #77054 is a reply to message #76970] Thu, 21 July 2011 10:38 Go to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On Jul 20, 1:57 pm, Tianyi Luo <tianyi.tu...@gmail.com> wrote:
> Hi everyone,
>
> I have a txt file which contains 900 rows of data, and in each row the
> amount of values is not exactly the same. Now what I wanna do is to
> select certain rows, say from the 90th to the 180th, and then try to
> find a value out of the rows by a given index. Thank you guys!
>

Hi,

I think your best best is to read the entire data set into a text
vector, then parse the individual lines as needed. I haven't tested
this but something like...

file = "mytext.txt"
nLines = FILE_LINES(file)
x = STRARR(nLINES)
OPENR, lun, file, /GET_LUN
READF, lun, x
FREE_LUN, lun

Now you can use STRSPLIT and friends to manage each of the lines you
are interested in.

Cheers,
Ben
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL runtime and X window
Next Topic: Hash in IDL?

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

Current Time: Wed Oct 08 11:44:23 PDT 2025

Total time taken to generate the page: 0.00521 seconds