[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: datenum does not understand num2str
From: |
Kamaraju S Kusumanchi |
Subject: |
Re: datenum does not understand num2str |
Date: |
Fri, 06 Apr 2012 16:13:05 -0400 |
User-agent: |
KNode/4.4.11 |
Ólafur Jens Sigurðsson wrote:
> On Sun, Apr 01, 2012 at 07:52:20PM -0400, Kamaraju S Kusumanchi wrote:
>> If this is a bug, I can file it. But just thought I will check here first
>> as it seems to be very basic.
>>
>> Using octave 3.2.4 on Debian Wheezy
>>
>> $octave -qf
>> octave:1> datenum('20120401', 'yyyymmdd')
>> ans = 734960
>> octave:2> datenum(num2str(20120401), 'yyyymmdd')
>> error: datevec: date not parsed correctly with given format
>> error: called from:
>> error: /usr/share/octave/3.2.4/m/time/datevec.m at line 140, column 11
>> error: /usr/share/octave/3.2.4/m/time/datenum.m at line 75, column 25
>> octave:2>
>>
>> FWIW, the command works under matlab 7.9.1.671 (R2009b) Service Pack 1.
>>
>> If I am guessing correctly, the format of the output from num2str cannot
>> be parsed correctly by datenum. Worth fixing or is there a work around?
>
> datenum(num2str(20120104, 8), 'yyyymmdd')
>
> Oli
Thanks for the workaround. I reported this bug as
https://savannah.gnu.org/bugs/?36117 . Hopefully, someone will fix it.
--
Kamaraju S Kusumanchi
http://malayamaarutham.blogspot.com/