Re: Writing a modified .txt file issue [message #85377 is a reply to message #85374] |
Mon, 29 July 2013 16:18   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Wayne Landsman writes:
> I haven't really tested this, but now STRSPLIT() can operate on a 2-d array and return the values in a list. So you can eliminate loops entirely
>
> mylist = strsplit(word,' ',/extract)
> myarr = mylist.toarray()
> data.date = myarr[*,0]
> data.time = myarr[*,1]
> data.latitude = double( myarr[*,2])
> data.longitude = double( myarr[*,3])
OK, I can get this to work if I change this line:
mylist = strsplit(word,' ',/extract)
To this:
mylist = strsplit(word,/extract)
I can't get this code by Heinz to work at all:
> for i=0,nColumns-2 do begin
> pos=strpos(word,' ')
> data.(i)=strmid(word,0,transpose(pos))
> word=strtrim(strmid(word,transpose(pos)),1)
> end
> data.(nColumns-1)=word
Does anyone have any less theoretical code? :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|