bugGNU Octave - Bugs: bug #36563, datevec compatability

 
 

bug #36563: datevec compatability

Submitter:  None
Submitted:  Wed 30 May 2012 03:33:57 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Alexander Barth Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.1
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 07 Jun 2012 04:33:05 PM UTC, comment #10: 

Thanks for the testing.  I have committed a patch to the development branch (http://hg.savannah.gnu.org/hgweb/octave/rev/b7675598094a) and updated the documentation.  The changes will become available in the 3.8.0 release of Octave.  If you need the changes sooner you can always build from Mercurial sources.

Rik <rik5>
Group administrator
Wed 06 Jun 2012 08:05:15 AM UTC, comment #9: 

Here is the output of datevec_strtest.m for matlab R2010a.

Alexander Barth <abarth>
Wed 06 Jun 2012 05:30:30 AM UTC, comment #8: 

I'm attaching a testing script "datevec_strtest.m" to this bug report that I hope someone can run under Matlab.  It will produce a result file named "datevec_strtest_results.txt" which I would like to have uploaded to this bug report.

(file #25986)

Rik <rik5>
Group administrator
Mon 04 Jun 2012 11:11:51 AM UTC, comment #7: 

In the revised patch (datevec-new.patch), I added support for the format 21,22, 25, 26 29 and 31.

I tested the code and I got the same results as in matlab R2010a (test_datevec.m).

However, formats 12,24,25 and 28 give quite strange (bogus?) result in matlab:

datevec('Mar00',12) % mmmyy

ans =   2012           2          29           0           0           0

datevec('01/03/2000',24) %dd/mm/yyyy,

ans =   2000           1           3           0           0           0

datevec('00/03/01',25) %yy/mm/dd

ans =   101     1     3     0     0     0


datevec('Mar2000',28) %mmmyyyy

ans =  2017           8          21           0           0           0

Can somebody with a newer version of matlab confirm this?

Format 24 gives the same results in octave 3.6.1 (with or without patch) than in matlab. However, day and month are reversed according to documentation.



(file #25981, file #25982)

Alexander Barth <abarth>
Sun 03 Jun 2012 07:16:10 PM UTC, comment #6: 

Added support for format--one-liner fix.

Anonymous
Sun 03 Jun 2012 04:01:30 PM UTC, comment #5: 

Thanks for verifying the format codes with Matlab.  There is already a patch attached to this bug which would implement compatibility for format 31.  If there are any other formats which should be supported you can follow the same strategy as in the patch.

Rik <rik5>
Group administrator
Sun 03 Jun 2012 12:46:12 PM UTC, comment #4: 

I will take on this bug. Tomorrow I will verify against Matlab R2012A--access it at work. In the meantime, I will attempt to implement this legacy case so that we can have the maximum possible compatibility.

Anonymous
Thu 31 May 2012 08:55:22 PM UTC, comment #3: 

Which version of Matlab was tested?  And do we want to follow their behavior or their documentation?

The documentation for datevec (http://www.mathworks.com/help/techdoc/ref/datevec.html) for release 2012A is very specific about which formats are supported.

Quoting the documentation:

"DateVector = datevec(DateString) converts date string DateString to date vector V. Input argument DateString must be in one of the date formats 0, 1, 2, 6, 13, 14, 15, 16, or 23 as defined in the section . This calling syntax is provided for backward compatibility, and is significantly slower than the syntax which specifies the format string. If the format is known, the V = datevec(DateString, FieldSpecIn) syntax is recommended."

The list of formats can be found here (http://www.mathworks.com/help/techdoc/matlab_prog/bspgcx2-1.html) with the section title "Numeric Identifiers for Predefined Formats".

As a first step, I think it would be useful if someone with access to a modern version of Matlab could verify all 32 formats using the examples in the table of Predefined Formats.

Rik <rik5>
Group administrator
Thu 31 May 2012 08:36:11 PM UTC, comment #2: 

Reposting original report here, looks like a formatting error. Savannah has some quirky formatting rules:

In Matlab, datevec understands the following format:


datevec ('2000-09-07 15:38:09')

ans =

       2000           9           7          15          38           9


while it returns an error in octave (none of the standard formats match the
DATE string). Attached is a patch with test.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Thu 31 May 2012 08:18:56 PM UTC, comment #1: 

Something happened to your bug submission and there is nothing there.  Please re-post.

Rik <rik5>
Group administrator
Wed 30 May 2012 03:33:57 PM UTC, original submission:  

In Matlab, datevec understands the following format:


datevec ('2000-09-07 15:38:09')

ans =

        2000           9           7          15          38           9
+verbatim+

while it returns an error in octave (none of the standard formats match the DATE string). Attached is a patch with test.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #25986:  datevec_strtest.m added by rik5 (2KiB - text/x-octave)
file #25981:  datevec-new.patch added by abarth (2KiB - text/x-patch)
file #25982:  test_datevec.m added by abarth (3KiB - text/x-objcsrc)
file #25957:  datevec.patch added by None (891B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by abarth (Updated the item)
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-06-07 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2012-06-06 abarth Attached File- Added datevec_strtest_results-matlab-R2010a.txt, #25987
    2012-06-06 rik5 Attached File- Added datevec_strtest.m, #25986
    2012-06-04 abarth Attached File- Added datevec-new.patch, #25981
        Attached File- Added test_datevec.m, #25982
    2012-05-31 rik5 StatusNone Need Info
    2012-05-30 None Attached File- Added datevec.patch, #25957

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code