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

Home » Public Forums » archive » 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
Efficient way to split an array of strings. [message #56818] Wed, 14 November 2007 17:10
bberkey is currently offline  bberkey
Messages: 2
Registered: November 2007
Junior Member
I 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?

Thanks
-Ben Berkey

Example data
3401601.15, 5 TRACK
3401601.20, 5 TRACK
3401601.25, 5 TRACK
3401601.26, 5 TRACK

My code
token = " "
count = 3

i = long64(0)
tot = n_elements(array)
splitarray = strarr(count,tot)
while(i LT tot) do begin
splitarray[i*count] = strsplit(array[i],token,/extract)
i = i +1
endwhile
[Message index]
 
Read Message
Previous Topic: IDLdoc 3.0
Next Topic: NaN Magic or Why Me?!

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

Current Time: Fri Oct 10 11:38:43 PDT 2025

Total time taken to generate the page: 1.17678 seconds