[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Timestamp problems...

From: PhilipNienhuis
Subject: Re: Timestamp problems...
Date: Mon, 28 Oct 2013 13:35:08 -0700 (PDT)

d.cunningham wrote
> Hello all,
> I have 20 CSV files full of data, but one column is a Timestamp saved as
> text, in the format "DD/MM/YYYY HH:MM:SS" 
> when trying to import directly Octave cannot read the matrix as there is
> text, but I cannot manipulate the data correctly without importing.
> when converting in other programmes, saving the text as a general or
> number data type, Octave can read the matrix but consistantly returns time
> and dates in the 1970's regardless of using epoch or unixtime etc...I
> believe this is because the numbers are being stored incorrectly after
> conversion.
> I am stuck - has anyone else imported and manipulated data with a text
> timestamp like mine?

In the Octave-Forge io package there's a function csv2cell() that can read
mixed-type csv files; it returns a cell array (obviously as you can't mix
character and numeric data types in a numeric array).

So, apply datenum() on the date string column (you might need to supply a
date format like "dd/mm/yyyy HH:MM:SS", see 'help datestr') and you'll be

Note: a prerequisite for cell2csv() is that all lines in your csv files
contain the same number of data.


View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]