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

Home » Public Forums » archive » problem using strsplit
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
problem using strsplit [message #33523] Fri, 10 January 2003 04:38 Go to previous message
briana is currently offline  briana
Messages: 2
Registered: January 2003
Junior Member
I am relatively new to IDL and am probably missing something very
obvious. I am reading in an ascii tab separated file into a string
array. I know how many rows the file will contain but not how many
columns hence the string array.
I then try to use strsplit to separate all the columns but have an
error - it seems that the columns are not seen as separate.
Code and example file below.

Any ideas would be useful,
Thanks
Brian Appleby
Geophysicist
BrianA@Zetica.com


pro test_ascii_reader
;setup some variable values to allow easy alteration if needed later
no_of_scans=1000
max_traces=1000

; open and read any ascii file with data/headers on single lines into
; a string array to be split later depending on type of data
OPENR, lun, 'file2.txt', / GET_LUN
rawdata=StrArr(no_of_scans)
Point_Lun, lun, 0
ReadF,lun,rawdata
help,rawdata

split_columns=STRSPLIT(rawdata,' ',/EXTRACT)
help,split_columns
end



file2.txt - example data
65408 65408 65408 65408 65408
28800 28800 28800 28800 28800
32896 32896 32896 32896 32896
33152 33152 33152 33152 33152
33152 33152 33152 33152 33152
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: WHERE and pointers
Next Topic: Scroll bars not appearing

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

Current Time: Wed Oct 08 15:34:19 PDT 2025

Total time taken to generate the page: 0.00497 seconds