From: Jos <x@y.z>
Path: news.mathworks.com!newsfeed-00.mathworks.com!webcrossing
Newsgroups: comp.soft-sys.matlab
Subject: Re: datestr problems
Message-ID: <ef5c642.0@webcrossing.raydaftYaTP>
Date: Tue, 3 Jul 2007 14:55:00 -0400
References: <ef5c642.-1@webcrossing.raydaftYaTP>
Lines: 52
NNTP-Posting-Host: 84.81.76.244
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Xref: news.mathworks.com comp.soft-sys.matlab:417063



Kelly wrote:
>
>
> I'm seeing some odd behavior with the datestr function. There
> seems
> to be an upper limit on the value of the month number in the input
> date vector in order to return the proper string. For example,
>
> datestr([1950 522 15 12 0 0])
>
> ans =
>
> 15-Jun-1993 12:00:00
>
> This is the answer that I was expecting. However,
>
> datestr([1950 523 15 12 0 0])
>
> ans =
>
> 03-May-0005
> 06-Jun-0001
> 15-Jan-0000
> 12-Jan-0000
> 00-Jan-0000
> 00-Jan-0000
>
> The problem seems to occur somewhere in the mex file that does the
> major calculations (datevecmx); for some reason it is returning 6 x
> 1
> vectors for the year, month, etc, instead of the scalar values it
> should be getting.
>
> Does anyone else see this behavior? Also, does anyone know of a
> workaround? I have a lot of data that is given in "months since
> 1950", and I am looking for an easy way to convert this to
> dd-mmm-yyyy strings.
>
> Thanks,
> Kelly
  
I see the same behavior. A workaround is to convert the date vector
to a datenumber

datestr([1950 523 15 12 0 0])
% --> list of dates

datestr(datenum([1950 523 15 12 0 0]))
% --> 15-Jul-1993 12:00:00

hth
Jos