|
Jos wrote:
>
>
> 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
The problem is with this boolean expression
all(abs(sum(D,2)-2000)<500) in line 167 of R2006b
The doc says:
A 3- or 6-element vector having a first element within an
approximate range of 500 greater than or less than the current year
is considered by MATLAB to be a date vector. Otherwise, it is
considered to be a vector of serial date numbers.
Someone didn't think about month having large values - I guess. Code
and documentation don't match exactly.
/ per
|