Why'd I leave the intermediate 't' in there? I don't know... Patch attached.
Dan
Daniel J Sebald wrote:
Hi Folks,
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.
Dan
PS: This is one slow function. Really bogs down programs working with
a lot of data.
BEFORE:
octave:1> S = {'2008-12-11'; '2008-12-12'; '2008-12-13'};
octave:2> datenum(char(S), 'yyyy-mm-dd')
ans = 733753
AFTER:
octave:11> S = {'2008-12-11'; '2008-12-12'; '2008-12-13'};
octave:12> datenum(char(S), 'yyyy-mm-dd')
ans =
733753
733754
733755
--- 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;
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev