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

Home » Public Forums » archive » Re: reading multiple data types into arrays
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: reading multiple data types into arrays [message #54689] Tue, 10 July 2007 12:49 Go to previous message
Josh is currently offline  Josh
Messages: 21
Registered: June 2007
Junior Member
On Jul 10, 12:57 am, greg.a...@googlemail.com wrote:
> On Jul 10, 12:36 am, Josh <joshuamonta...@gmail.com> wrote:
>
>
>
>> Hi,
>
>> I'm trying to read in data from a file that has the following format:
>
>> 231359152 09/25/2003 18:38:35.816 20.013574 25.668425
>> 626.779 14.396667
>
>> I'm having no problems getting the fourth, fifth, and sixth columns of
>> data into double arrays with a statement like this:
>
>> readf, lun, recNum, date, time, lat, lon, elev, geoid
>
>> and a for loop. But I would like to get the second column in an
>> array, too. My intuition says it should be a string because of the
>> nasty /'s in it (ultimately, I'd like these dates to be the
>> independant axis values).
>
>> I tried declaring the variable date as a string beforehand (date = '
>> '), but then that slurps the entire line (all columns) into that
>> variable. If I don't declare it as a string and try to put it into a
>> string array (strArr), it becomes 9.00000.
>
>> I'm reading the documentation for explicitly formatted input, but am
>> having trouble figuring out how to apply it here.
>
>> As always, all suggestions are greatly appreciated!
>> -Josh
>
> I'd probably read the whole line as a string then split it on the
> spaces with strsplit() and convert after. Better still, you might just
> read the whole file into a string array and chop it up with strpos()
> and strmid().
>
> Greg



Thanks, Greg. For me, this turned out to be the easiest way to
achieve this task. Much appreciated. -J
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: A Challenge?
Next Topic: Re: MOD43B3 Col.4 Processing. unexpected error message. why?

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

Current Time: Wed Oct 08 18:55:55 PDT 2025

Total time taken to generate the page: 0.00559 seconds