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

Home » Public Forums » archive » How Could I read dates(strings) into a structure?
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: How Could I read dates(strings) into a structure? [message #94842 is a reply to message #94839] Thu, 02 November 2017 08:20 Go to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Wednesday, November 1, 2017 at 9:07:34 PM UTC+1, Lim wrote:

Move the FORMAT to READF:

datastruct={MyDate:' ', MyTime:' ', var1:0.0, var2:0.0, var3:0.0}
Mydata=Replicate(datastruct, nlines)

OpenR,lun, FileIn,/Get_Lun
ReadF,lun, Mydata, format='(A10,3X,A8,3F9.4)'
Free_Lun, lun

regards,
Lajos


> Hi,
>
> I wonder if someone could show me how could I read dates (strings) into a structure.
>
> I need to read thousands of files each with thousands of lines like this one:
>
> FileIn1:
>
> 2015-06-01 11:02:28 -17.8620 -34.3080 -12.1940
> 2015-06-01 11:02:29 -12.4835 -24.4790 -8.8535
> 2015-06-01 11:02:30 -10.9240 -22.0480 -7.8587
> 2015-06-01 11:02:31 -11.6355 -22.9650 -8.0603
> 2015-06-01 11:02:32 -12.7080 -26.4340 -8.5855
> 2015-06-01 11:02:33 -12.4525 -24.8820 -8.4100
> 2015-06-01 11:02:34 -11.2980 -23.5610 -7.9932
> 2015-06-01 11:02:44 8.8110 12.8375 4.2657
> 2015-06-01 11:03:00 -5.4033 -10.9245 -3.4665
> 2015-06-01 11:03:01 -9.4730 -19.0120 -5.6915
>
>
> I have done the following:
>
> ==========
> Pro ReadMyData
> Close, /All
>
> FileIn='FileIn1'
> nlines=File_lines(FileIn)
>
> datastruct={MyDate:' ', MyTime:' ', var1:0.0, var2:0.0, var3:0.0}
> Mydata=Replicate(datastruct, nlines)
> Mydata.MyDate = STRING(Mydata.MyDate, FORMAT = '(A10)')
> Mydata.MyTime = STRING(Mydata.MyTime, FORMAT = '(A10)')
>
> OpenR,lun, FileIn,/Get_Lun
> ReadF,lun, dataw
> Free_Lun, lun
>
> End
> =====
>
> However, I get the error message: READF: Input conversion error. Unit: 100.
>
> I will appreciate any assistance.
>
> Thanks
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: harrisgeospatial unreachable...
Next Topic: mpfit

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

Current Time: Wed Oct 08 13:51:57 PDT 2025

Total time taken to generate the page: 0.00437 seconds