octave-maintainers
[Top][All Lists]
Advanced

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

Re: [OctDev] datevec bugs


From: Daniel J Sebald
Subject: Re: [OctDev] datevec bugs
Date: Thu, 11 Dec 2008 21:00:09 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

OK, thanks Soren...

Folks, attached is a small patch to fix a couple bugs in datevec.m so that it 
works with string arrays and cell string arrays.

Dan

PS: A faster version of datevec would be welcome.  It seems to require 7/100 of 
a second to do a single conversion on my machine.



Soren Hauberg wrote:
ons, 10 12 2008 kl. 03:05 -0600, skrev Daniel J Sebald:

Here is a patch to fix some problems with datevec in working with
string arrays and cell arrays.  One bug is a strange assignment of
all strings to a cell of size 1 when cellstr() seems clearly
preferred.  A second bug is that length() gives an incorrect value
when the number of date strings is greater than the character
width.


'datevec' seems to be part of core Octave, so could you send your
patch to address@hidden Otherwise, I fear people with commit access
to Octave won't see your patch.

Soren

--- datevec.m.orig      2008-12-10 02:35:30.000000000 -0600
+++ datevec.m   2008-12-10 22:20:10.496119963 -0600
@@ -108,9 +108,7 @@
   endif
 
   if (ischar (date))
-    t = date;
-    date = cell (1);
-    date{1} = t;
+    date = cellstr (date);
   endif
 
   if (iscell (date))
@@ -247,7 +245,7 @@
 
   [tm, nc] = strptime (ds, f);
 
-  if (nc == length (ds) + 1)
+  if (nc == size (ds, 2) + 1)
     y = tm.year + 1900; m = tm.mon + 1; d = tm.mday;
     h = tm.hour; mi = tm.min; s = tm.sec + tm.usec / 1e6;
     found = true;

reply via email to

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