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

Home » Public Forums » archive » Reading in date & time from csv file
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 in date & time from csv file [message #88623 is a reply to message #88621] Mon, 19 May 2014 08:39 Go to previous message
justinclouds is currently offline  justinclouds
Messages: 25
Registered: December 2012
Junior Member
On Monday, May 19, 2014 9:27:32 AM UTC-6, Phillip Bitzer wrote:
> On Sunday, May 18, 2014 3:25:45 PM UTC-5, justinclouds wrote:
>
>>
>
>> Can anybody help with what needs to be changed here to read this correctly or suggest an alternate method.
>
>>
>
>>
>
>
>
> So, the problem seems to be READ_CSV doesn't seem to detect the first column is a string, correct?
>
>
>
> IDL> f = 'test.txt'
>
> IDL> data = READ_CSV(f)
>
>
>
> IDL> help, data
>
> ** Structure <247e2b8>, 2 tags, length=64, data length=64, refs=1:
>
> FIELD1 DOUBLE Array[4]
>
> FIELD2 DOUBLE Array[4]
>
> IDL> print, data.field1
>
> 2014.0000 2014.0000 2014.0000 2014.0000
>
>
>
> Not sure why - but I don't use READ_CSV much.
>
>
>
> Using READCOL works just fine, as I can specify the format of each column easily:
>
> IDL> READCOL, f, date, val, FORMAT='A, F'
>
>
>
> IDL> print, date
>
> 2014_05_12_18_39_33.194 2014_05_12_19_39_33.194 2014_05_12_20_39_33.194 2014_05_12_21_39_33.194
>
>
>
> Then, you can use STR_SPLIT as Matt suggested...if you're on IDL 8. Otherwise, you'll have to get fancy with STREGEX.
>
>
>
> ----------------------
>
> Here's the test file I used:
>
> ----------------------
>
> 2014_05_12_18_39_33.194, 1.0
>
> 2014_05_12_19_39_33.194, 2.0
>
> 2014_05_12_20_39_33.194, 3.0
>
> 2014_05_12_21_39_33.194, 4.0

Thanks. I did just what you suggested and we must have been posting this at the same time! Thanks!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: hot pixels
Next Topic: The refresh method and relative coordinate positioning

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

Current Time: Wed Oct 08 15:28:08 PDT 2025

Total time taken to generate the page: 0.00407 seconds