help-octave
[Top][All Lists]
Advanced

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

Re: datenum does not understand num2str


From: Ólafur Jens Sigurðsson
Subject: Re: datenum does not understand num2str
Date: Mon, 2 Apr 2012 10:56:36 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

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


reply via email to

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