help-octave
[Top][All Lists]
Advanced

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

Re: How to read in Date from Excel file?


From: Markus Bergholz
Subject: Re: How to read in Date from Excel file?
Date: Thu, 19 Dec 2013 08:43:42 +0100




On Thu, Dec 19, 2013 at 8:15 AM, lisa_octave <address@hidden> wrote:
Dear all,
I have a piece of matlab code like
/[num1 txt1]  = xlsread(Filename,SheetNameSwap);
DF = num1(1:12,1);
DFDates = txt1(1:12,1);
DFSerialDate = datenum(DFDates);
/

Actually, DF is supposed to be numbers and DFDates is supposed to be dates
(saved in date/string format).

However I found that in Octave, DF automatically turns into the julian date
of dates in Excel, i.e. a series of numbers like 41627. It looks like Octave
changes date value in Excel into julian date first, then take it as
numerical values..


Dates are stored as serialnumber in excel too.

If i read an excel sheet and column 1 are dates and times
octave:5> a(3,1)
ans =    0.657118055555556
octave:6> datestr(a(3,1))
ans = 15:46 PM
octave:7> datestr(a(1,1))
ans = 02-Jan-2009



 
Also, datenum() function didn't work here.

I've heard that Octave does not accept date formats, but say, I really have
to deal with dates, then what should I do?


Yes, but It's a mystery to me how to deal with dates in string format. It's easier to handle them when they are in serial number format.


date, clock, time datenum, datestr and datevec are your friends

octave:9> clear all
octave:10> a=date
a = 19-Dec-2013
octave:11> b=time
b =     1387438901.30305
octave:12> c=clock
c =

                  2013                    12                    19                     8                    41             46.484437

octave:13> datenum (a)
ans =               735587
octave:14> datestr (ans)
ans = 19-Dec-2013

 
Thanks for any response!




--
View this message in context: http://octave.1599824.n4.nabble.com/How-to-read-in-Date-from-Excel-file-tp4660211.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave



--
icq: 167498924
XMPP|Jabber: address@hidden

reply via email to

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