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 #88621 is a reply to message #88616] Mon, 19 May 2014 08:27 Go to previous messageGo to previous message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
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
[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 20:10:51 PDT 2025

Total time taken to generate the page: 0.00706 seconds