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

Home » Public Forums » archive » Re: Efficient way to split an array of strings.
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: Efficient way to split an array of strings. [message #56817 is a reply to message #56814] Wed, 14 November 2007 17:39 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
bberkey@gmail.com writes:

> have a lot of data that comes to me in tabular files with a nice mix
> of strings and numerical data. Typically I will read the data into a
> string array. And then loop over each line in the file calling
> STRSPLIT repeatably.
>
> Is there a better way to accomplish this?

Why don't you just read the data from the file
directly:

OpenR, lun, 'test.dat', /Get_LUN
rows = File_Lines('test.dat')
struct = {f:0.0D, I:0, s:''}
data = Replicate(struct, rows)
ReadF, lun, data
Free_Lun, lun

Print, data.f, Format='(F10.2)'
Print, data.I
Print, data.s

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
Previous Topic: NaN Magic or Why Me?!
Next Topic: version 7

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

Current Time: Thu Oct 09 07:52:00 PDT 2025

Total time taken to generate the page: 0.48115 seconds