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

Home » Public Forums » archive » Writing a modified .txt file issue
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: Writing a modified .txt file issue [message #85377 is a reply to message #85374] Mon, 29 July 2013 16:18 Go to previous messageGo to previous message
David Fanning is currently offline  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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Find all user-defined structure definitions
Next Topic: Multiple plots with plot function

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

Current Time: Fri Oct 10 23:07:13 PDT 2025

Total time taken to generate the page: 2.16055 seconds